SlideShare a Scribd company logo
1 of 45
Download to read offline
Cameron Tod - Solutions Architect, Acquia!
@cam8001
Who am I???
•

From New Zealand (sorry for the
accent)

•

Live in Hackney

•

Solutions Architect @ Acquia

•

A casual contributor to Drupal core

•

Maintain a few simple modules on
d.o

•

Like to help new contributors as
much as I can

•

cam8001 on drupal.org, IRC, Twitter
Get yourself set up
The cli is your friend
•

Use git on command line. If this scares you, I
can comfort you.

•

If you are on OS X - use brew!

•

If you are on Linux, use your package manager

•

If you are on Windows, try this https://drupal.org/
documentation/git/install
First, git clone
•

Gets a complete copy of Drupal and all its
history
██ cameron.tod @ kerbcrawler:~

🍺

██ 13:02:45 $ git clone --branch 8.x http://git.drupal.org/project/drupal.git
Cloning into 'drupal'...
remote: Counting objects: 319961, done.
remote: Compressing objects: 100% (62618/62618), done.
remote: Total 319961 (delta 223601), reused 317995 (delta 222129)
Receiving objects: 100% (319961/319961), 74.74 MiB | 291.00 KiB/s, done.
Resolving deltas: 100% (223601/223601), done.
Checking connectivity... done

██ cameron.tod @ kerbcrawler:~/Sites/drupal (8.x)

🍺

██ 01:13:34 $ git lg 008612ad4999138662a32abab2115cf3f03bca64
* 008612a - Imported sources (14 years ago) <Dries Buytaert>
Our workflow
1. Create your issue branch
2. Make your changes
3. Stage your changes
4. Commit your changes
5. Make a patch file
6. Upload it to drupal.org for review
Commit
•

A single changeset, relative to a repository and
file system

•

Git stores commits as snapshots

•

Commit metadata; author, timestamp, message
Photo credit!
Sankatha Bamanuge!
https://drupal.org/user/566194
So what is a branch?
•

A branch is a stream of commits

•

A branch has full history

•

One repo can have many branches

•

You can branch at any point, or merge branches
back together into a single history
Files have 3 states
•

Committed

•

Modified

•

Staged
1. Create your issue branch
Creates a new branch

██ cameron.tod @ kerbcrawler:~/Sites/drupal-pres (8.x)

Branch name prefixed with issue number

🍺

██ 15:47:07 $ git checkout -b 2091511-cache_form_expiry_to_variable
Switched to a new branch '2091511-cache_form_expiry_to_variable'

!

██ cameron.tod @ kerbcrawler:~/Sites/drupal-pres (2091511-cache_form_expiry_to_variable)

🍺

██ 15:47:13 $
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 15:47:54 $ git branch
* 2091511-cache_form_expiry_to_variable
8.x

Brief description of the issue
2. Make your changes
hack hack hack
Modified state
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 00:40:39 $ git status
# On branch 2091511-cache_form_expiry_to_variable
#
# Changes not staged for commit:
#
(use "git add <file>..." to update what will be committed)
#
(use "git checkout -- <file>..." to discard changes in working directory)
#
#
modified:
core/lib/Drupal/Core/Form/FormBuilder.php
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 00:42:09 $ git diff core/lib/Drupal/Core/Form/FormBuilder.php

!

diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 49692d9..d70bf4f 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) {
* {@inheritdoc}
*/
public function setCache($form_build_id, $form, $form_state) {
// 6 hours cache life time for forms should be plenty.
$expire = 21600;
+
$expire = Drupal::config('system.form')->get('cache_expire');
// Cache form structure.
if (isset($form)) {
3. Stage your changes
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 01:53:46 $ git add core/lib/Drupal/Core/Form/FormBuilder.php
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)
██ 01:28:58 $ git status
# On branch 2091511-cache_form_expiry_to_variable
# Your branch is behind 'origin/8.x' by 17 commits, and can be fast-forwarded.
#
(use "git pull" to update your local branch)
#
# Changes to be committed:
#
(use "git reset HEAD <file>..." to unstage)
#
#
modified:
core/lib/Drupal/Core/Form/FormBuilder.php

🍺
4. Commit your changes
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 01:32:38 $ git commit -m 'Added form expiration as a config.'
[2091511-cache_form_expiry_to_variable 7d1ca38] Added form expiration as a config.
1 file changed, 1 insertion(+), 2 deletions(-)

!

██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 16:30:09 $ git lg
* 22edfd2 - (HEAD, 2091511-cache_form_expiry_to_variable) Added form expiration as a config. (57 seconds ago) <Cameron Tod>
* 5fb617d - Issue #1938926 by sun, Cottser, joelpittet, pplantinga: Convert simpletest theme tables to table #type. (21 hours ago) <Dries>
5. Make a patch file
•

A patch file is a commit changeset, saved in a
text file

•

When you upload your patch to Drupal:
•

The testbots pick it up, apply the patch to
Drupal core, and test it on qa.drupal.org

•

Other contributors can download it and apply
it to their git repository
$ git diff origin/8.x
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 49692d9..d70bf4f 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) {
* {@inheritdoc}
*/
public function setCache($form_build_id, $form, $form_state) {
// 6 hours cache life time for forms should be plenty.
$expire = 21600;
+
$expire = Drupal::config('system.form')->get('cache_expire');
// Cache form structure.
if (isset($form)) {

$ git diff origin/8.x > 2091511-cache_form_expiry_to_variable-27.patch

$ cat 2091511-cache_form_expiry_to_variable-27.patch
diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php
index 49692d9..d70bf4f 100644
--- a/core/lib/Drupal/Core/Form/FormBuilder.php
+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) {
* {@inheritdoc}
*/
public function setCache($form_build_id, $form, $form_state) {
// 6 hours cache life time for forms should be plenty.
$expire = 21600;
+
$expire = Drupal::config('system.form')->get('cache_expire');
// Cache form structure.
if (isset($form)) {
But don’t forget to rebase
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 22:52:22 $ git fetch
remote: Counting objects: 857, done.
remote: Compressing objects: 100% (234/234), done.
remote: Total 534 (delta 334), reused 324 (delta 199)
Receiving objects: 100% (534/534), 93.66 KiB | 0 bytes/s, done.
Resolving deltas: 100% (334/334), completed with 225 local objects.
From http://git.drupal.org/project/drupal
7d985d5..3ae51ab 8.x
-> origin/8.x
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 22:54:12 $ git rebase origin/8.x
First, rewinding head to replay your work on top of it...
Applying: Added form expiration as a config.
Applying: Adding closing newline to system.form.yml.
Applying: Explicitly set cache expiry for cache_form.
Applying: Moved form_cache expire setting into system_performance.yml.
Applying: Added new config key to tests.
Applying: Added config schema for new config key.
Applying: Changed form cache expire key.
Applying: Added config.factory stub to test.
Applying: Added value to config factory stub.
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)

🍺

██ 22:55:49 $ git lg
* b23c13a - (HEAD, 2091511-cache_form_expiry_to_variable) Added value to config factory stub. (57 seconds ago) <Cameron Tod>
* 0c2eec4 - Added config.factory stub to test. (57 seconds ago) <Cameron Tod>
* 4df1959 - Changed form cache expire key. (57 seconds ago) <Cameron Tod>
* e2f18d3 - Added config schema for new config key. (57 seconds ago) <Cameron Tod>
* 0f54db6 - Added new config key to tests. (57 seconds ago) <Cameron Tod>
* cef2510 - Moved form_cache expire setting into system_performance.yml. (57 seconds ago) <Cameron Tod>
* 141ce4e - Explicitly set cache expiry for cache_form. (58 seconds ago) <Cameron Tod>
* 9346d8e - Adding closing newline to system.form.yml. (58 seconds ago) <Cameron Tod>
* 9408e2c - Added form expiration as a config. (58 seconds ago) <Cameron Tod>
* 3ae51ab - (origin/HEAD, origin/8.x) Issue #2201149 by sidharthap, sandipmkhairnar: Remove comment_entity_info cache deletes. (11 hours ago)
<Nathaniel Catchpole>
Keep commits small
$ git lg 668d277...
* b23c13a - (HEAD, 2091511-cache_form_expiry_to_variable) Added value to config factory stub. (3 hours ago) <Cameron Tod>
* 0c2eec4 - Added config.factory stub to test. (3 hours ago) <Cameron Tod>
* 4df1959 - Changed form cache expire key. (3 hours ago) <Cameron Tod>
* e2f18d3 - Added config schema for new config key. (3 hours ago) <Cameron Tod>
* 0f54db6 - Added new config key to tests. (3 hours ago) <Cameron Tod>
* cef2510 - Moved form_cache expire setting into system_performance.yml. (3 hours ago) <Cameron Tod>
* 141ce4e - Explicitly set cache expiry for cache_form. (3 hours ago) <Cameron Tod>
* 9346d8e - Adding closing newline to system.form.yml. (3 hours ago) <Cameron Tod>
* 9408e2c - Added form expiration as a config. (3 hours ago) <Cameron Tod>
* 3ae51ab - (origin/HEAD, origin/8.x) Issue #2201149 by sidharthap, sandipmkhairnar: Remove comment_entity_info cache deletes. (14 hours ago)
<Nathaniel Catchpole>
6. Upload your patch
for review
If you remember one
thing
Branch per issue
██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable)
██ 02:12:20 $ git branch
2084637-aggregator-test
2084637-service-container-automated-wrappers
2084637-service-container-automated-wrappers-foundation-only
2084637-service-container-with-get-prefix
* 2091511-cache_form_expiry_to_variable
2205797-configmanager-unit-test
2205799-phpunit_consistent_config
8.x
8.x-SystemControllerTest-namespace
maintenance-mode-cache-pages-1032936-fixes
maintenance-mode-cache-pages-1032936-tests
maintenance-mode-cache-pages-1032936-tests-travis

🍺
Branches are cheap
•

Create ‘em like crazy!

•

They take no time at all!!

•

You can branch from any point!

•

Create one for every issue!

•

Remember, everything is a branch.
And you can branch from a branch.!

•

Switch between branches quickly
and easily!

•

No one else will ever see them.
You can’t break Drupal core with git
If you remember one (more)
thing…
•

Everything is a branch

•

Everything is a branch

•

Everything is a branch

•

Every commit? A fully functional branch

•

Every tag? A branch.

•

Your remote upstream server (git.drupal.org)? A branch.
Locally.

•

A branch?? A branch.
Use case: test + fix branch
$ git checkout
maintenance-mode-cache-pages-1032936-fixes
Checking out files: 100% (5288/5288), done.
Switched to branch 'maintenance-mode-cache-pages-1032936-fixes'

$ git checkout
maintenance-mode-cache-pages-1032936-tests
Switched to branch 'maintenance-mode-cache-pages-1032936-tests'

$ git checkout -b maintenance-mode-cache-pages-1032936-tests+fixes
Switched to a new branch 'maintenance-mode-cache-pages-1032936-tests+fixes'
$ git merge maintenance-mode-cache-pages-1032936-fixes
Merge made by the 'recursive' strategy.
core/includes/bootstrap.inc | 5 ++++1 file changed, 4 insertions(+), 1 deletion(-)
Handy stuff
Apply a patch
$ wget https://drupal.org/files/issues/2091511-cache_form_expiry_to_variable-27.patch
--2014-03-01 03:06:00-- https://drupal.org/files/issues/2091511-cache_form_expiry_to_variable-27.patch
Resolving drupal.org... 140.211.10.62, 140.211.10.16
Connecting to drupal.org|140.211.10.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2969 (2.9K) [text/plain]
Saving to: ‘2091511-cache_form_expiry_to_variable-27.patch’

!

100%
[===========================================================================================================================================
==================>] 2,969
--.-K/s
in 0s

!
2014-03-01 03:06:01 (1.38 GB/s) - ‘2091511-cache_form_expiry_to_variable-27.patch’ saved [2969/2969]
!
!
!

██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable-presentation)

🍺

██ 03:06:01 $ git apply -v --index 2091511-cache_form_expiry_to_variable-27.patch
Checking patch core/lib/Drupal/Core/Form/FormBuilder.php...
Checking patch core/modules/system/config/schema/system.schema.yml...
Checking patch core/modules/system/config/system.performance.yml...
Checking patch core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php...
Checking patch core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php...
Applied patch core/lib/Drupal/Core/Form/FormBuilder.php cleanly.
Applied patch core/modules/system/config/schema/system.schema.yml cleanly.
Applied patch core/modules/system/config/system.performance.yml cleanly.
Applied patch core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php cleanly.
Applied patch core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php cleanly.
$ git commit -m 'Applied 2091511-cache_form_expiry_to_variable-27.patch'
[2091511-cache_form_expiry_to_variable-presentation d4290d8] Applied 2091511-cache_form_expiry_to_variable-27.patch
5 files changed, 14 insertions(+), 3 deletions(-)
Use git, kthx
Any questions?
Resources
•

https://drupal.org/project/drupal/git-instructions

•

http://drupalladder.org/

•

Drush 7 for Drupal 8: https://github.com/drush-ops/drush

•

Show branch in prompt: http://www.neverstopbuilding.com/gitpro

•

Git Number: https://github.com/holygeek/git-number

•

git lg: https://coderwall.com/p/euwpig

•

D8 reset script: https://gist.github.com/cam8001/9270022

•

Ask me! @cam8001
Thank you!
•

Slides will be on http://2014.drupalcamplondon.co.uk/

•

Come to Drupal monthly sprints at Techhub @
Campus, Shoreditch

•

We are hiring! Technical Architects, Devops,
Technical Account Managers, Solutions Architects.
Come and find me if you’re interested :)

More Related Content

What's hot

Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentSadique Puthen
 
Shaping Clouds with Terraform
Shaping Clouds with TerraformShaping Clouds with Terraform
Shaping Clouds with TerraformMike Fowler
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedAnne Nicolas
 
ATO Linux Performance 2018
ATO Linux Performance 2018ATO Linux Performance 2018
ATO Linux Performance 2018Brendan Gregg
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductortimyates
 
Varnish @ Velocity Ignite
Varnish @ Velocity IgniteVarnish @ Velocity Ignite
Varnish @ Velocity IgniteArtur Bergman
 
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFBrendan Gregg
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
Velocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFVelocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFBrendan Gregg
 
Oracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesOracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesKyle Hailey
 
ClickHouse Monitoring 101: What to monitor and how
ClickHouse Monitoring 101: What to monitor and howClickHouse Monitoring 101: What to monitor and how
ClickHouse Monitoring 101: What to monitor and howAltinity Ltd
 
Debugging linux issues with eBPF
Debugging linux issues with eBPFDebugging linux issues with eBPF
Debugging linux issues with eBPFIvan Babrou
 
Creating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseCreating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseAltinity Ltd
 
Rman duplicate-database-on-the-same-host1
Rman duplicate-database-on-the-same-host1Rman duplicate-database-on-the-same-host1
Rman duplicate-database-on-the-same-host1hunghtc83
 
Oracle cluster installation with grid and iscsi
Oracle cluster  installation with grid and iscsiOracle cluster  installation with grid and iscsi
Oracle cluster installation with grid and iscsiChanaka Lasantha
 
How to Troubleshoot OpenStack Without Losing Sleep
How to Troubleshoot OpenStack Without Losing SleepHow to Troubleshoot OpenStack Without Losing Sleep
How to Troubleshoot OpenStack Without Losing SleepSadique Puthen
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFBrendan Gregg
 
NetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityNetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityBrendan Gregg
 

What's hot (20)

Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deployment
 
Shaping Clouds with Terraform
Shaping Clouds with TerraformShaping Clouds with Terraform
Shaping Clouds with Terraform
 
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all startedKernel Recipes 2019 - ftrace: Where modifying a running kernel all started
Kernel Recipes 2019 - ftrace: Where modifying a running kernel all started
 
ATO Linux Performance 2018
ATO Linux Performance 2018ATO Linux Performance 2018
ATO Linux Performance 2018
 
Using Git as your VCS with Bioconductor
Using Git as your VCS with BioconductorUsing Git as your VCS with Bioconductor
Using Git as your VCS with Bioconductor
 
Varnish @ Velocity Ignite
Varnish @ Velocity IgniteVarnish @ Velocity Ignite
Varnish @ Velocity Ignite
 
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
Velocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPFVelocity 2017 Performance analysis superpowers with Linux eBPF
Velocity 2017 Performance analysis superpowers with Linux eBPF
 
Oracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueuesOracle 10g Performance: chapter 09 enqueues
Oracle 10g Performance: chapter 09 enqueues
 
ClickHouse Monitoring 101: What to monitor and how
ClickHouse Monitoring 101: What to monitor and howClickHouse Monitoring 101: What to monitor and how
ClickHouse Monitoring 101: What to monitor and how
 
BPF Tools 2017
BPF Tools 2017BPF Tools 2017
BPF Tools 2017
 
Debugging linux issues with eBPF
Debugging linux issues with eBPFDebugging linux issues with eBPF
Debugging linux issues with eBPF
 
Creating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouseCreating Beautiful Dashboards with Grafana and ClickHouse
Creating Beautiful Dashboards with Grafana and ClickHouse
 
Rman duplicate-database-on-the-same-host1
Rman duplicate-database-on-the-same-host1Rman duplicate-database-on-the-same-host1
Rman duplicate-database-on-the-same-host1
 
Upgrade & ndmp
Upgrade & ndmpUpgrade & ndmp
Upgrade & ndmp
 
Oracle cluster installation with grid and iscsi
Oracle cluster  installation with grid and iscsiOracle cluster  installation with grid and iscsi
Oracle cluster installation with grid and iscsi
 
How to Troubleshoot OpenStack Without Losing Sleep
How to Troubleshoot OpenStack Without Losing SleepHow to Troubleshoot OpenStack Without Losing Sleep
How to Troubleshoot OpenStack Without Losing Sleep
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPF
 
NetConf 2018 BPF Observability
NetConf 2018 BPF ObservabilityNetConf 2018 BPF Observability
NetConf 2018 BPF Observability
 

Viewers also liked

Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7Chris Caple
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23msohn
 
Awesome Git Workflow for Agencies and Teams
Awesome Git Workflow for Agencies and TeamsAwesome Git Workflow for Agencies and Teams
Awesome Git Workflow for Agencies and TeamsChris Reynolds
 
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI DemonstrationGerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI Demonstrationvanoorts
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14msohn
 
CakeDC Git Workflow extension
CakeDC Git Workflow extensionCakeDC Git Workflow extension
CakeDC Git Workflow extensionLubomír Štork
 
Anton Parkhomenko Boost your design workflow or git rebase for designers
Anton Parkhomenko Boost your design workflow or git rebase for designersAnton Parkhomenko Boost your design workflow or git rebase for designers
Anton Parkhomenko Boost your design workflow or git rebase for designersАліна Шепшелей
 
Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Gitdirtytactics
 
Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson
Effective Development With Eclipse Mylyn, Git, Gerrit and HudsonEffective Development With Eclipse Mylyn, Git, Gerrit and Hudson
Effective Development With Eclipse Mylyn, Git, Gerrit and HudsonChris Aniszczyk
 
Drupal 7 Tutorial: Features Module
Drupal 7 Tutorial: Features ModuleDrupal 7 Tutorial: Features Module
Drupal 7 Tutorial: Features ModuleAcquia
 
Drupal Deployment
Drupal DeploymentDrupal Deployment
Drupal DeploymentJeff Eaton
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productiveKarsten Dambekalns
 

Viewers also liked (15)

Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
 
Awesome Git Workflow for Agencies and Teams
Awesome Git Workflow for Agencies and TeamsAwesome Git Workflow for Agencies and Teams
Awesome Git Workflow for Agencies and Teams
 
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI DemonstrationGerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
 
Gerrit Code Review
Gerrit Code ReviewGerrit Code Review
Gerrit Code Review
 
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
 
CakeDC Git Workflow extension
CakeDC Git Workflow extensionCakeDC Git Workflow extension
CakeDC Git Workflow extension
 
Anton Parkhomenko Boost your design workflow or git rebase for designers
Anton Parkhomenko Boost your design workflow or git rebase for designersAnton Parkhomenko Boost your design workflow or git rebase for designers
Anton Parkhomenko Boost your design workflow or git rebase for designers
 
Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
 
Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson
Effective Development With Eclipse Mylyn, Git, Gerrit and HudsonEffective Development With Eclipse Mylyn, Git, Gerrit and Hudson
Effective Development With Eclipse Mylyn, Git, Gerrit and Hudson
 
Drupal 7 Tutorial: Features Module
Drupal 7 Tutorial: Features ModuleDrupal 7 Tutorial: Features Module
Drupal 7 Tutorial: Features Module
 
Ultimate Git Workflow - Seoul 2015
Ultimate Git Workflow - Seoul 2015Ultimate Git Workflow - Seoul 2015
Ultimate Git Workflow - Seoul 2015
 
Drupal Deployment
Drupal DeploymentDrupal Deployment
Drupal Deployment
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
Gerrit Code Review
Gerrit Code ReviewGerrit Code Review
Gerrit Code Review
 

Similar to Cameron Tod - Solutions Architect at Acquia Shares Drupal Development Best Practices

DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDocker, Inc.
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingSteve Smith
 
Git presentation bixlabs
Git presentation bixlabsGit presentation bixlabs
Git presentation bixlabsBixlabs
 
Enjoying k8s cluster with Minikube and Helm
Enjoying k8s cluster with Minikube and HelmEnjoying k8s cluster with Minikube and Helm
Enjoying k8s cluster with Minikube and Helmロフト くん
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucketazwildcat
 
Adrian Mouat - Docker Tips and Tricks
 Adrian Mouat - Docker Tips and Tricks Adrian Mouat - Docker Tips and Tricks
Adrian Mouat - Docker Tips and TricksKevin Cross
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a gitBerny Cantos
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-itAutomat-IT
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom imaget lc
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom imaget lc
 
Transformative Git Practices
Transformative Git PracticesTransformative Git Practices
Transformative Git PracticesNicola Paolucci
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHubLucas Videla
 
DeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerDeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerSteve Smith
 
In Git we trust, by Carlos Guzman
In Git we trust, by Carlos GuzmanIn Git we trust, by Carlos Guzman
In Git we trust, by Carlos GuzmanCarlos Guzmán
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Chu-Siang Lai
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Ontico
 

Similar to Cameron Tod - Solutions Architect at Acquia Shares Drupal Development Best Practices (20)

Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 
Git使用
Git使用Git使用
Git使用
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration training
 
Git presentation bixlabs
Git presentation bixlabsGit presentation bixlabs
Git presentation bixlabs
 
Enjoying k8s cluster with Minikube and Helm
Enjoying k8s cluster with Minikube and HelmEnjoying k8s cluster with Minikube and Helm
Enjoying k8s cluster with Minikube and Helm
 
Basic git
Basic gitBasic git
Basic git
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
 
Adrian Mouat - Docker Tips and Tricks
 Adrian Mouat - Docker Tips and Tricks Adrian Mouat - Docker Tips and Tricks
Adrian Mouat - Docker Tips and Tricks
 
Sacándole jugo a git
Sacándole jugo a gitSacándole jugo a git
Sacándole jugo a git
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom image
 
Creating docker custom image
Creating docker custom imageCreating docker custom image
Creating docker custom image
 
Now i git it!!!
Now i git it!!!Now i git it!!!
Now i git it!!!
 
Transformative Git Practices
Transformative Git PracticesTransformative Git Practices
Transformative Git Practices
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
DeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to DockerDeveloperWeek 2015: A Practical Introduction to Docker
DeveloperWeek 2015: A Practical Introduction to Docker
 
In Git we trust, by Carlos Guzman
In Git we trust, by Carlos GuzmanIn Git we trust, by Carlos Guzman
In Git we trust, by Carlos Guzman
 
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
Continuous Delivery Workshop with Ansible x GitLab CI (2nd+)
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 

Cameron Tod - Solutions Architect at Acquia Shares Drupal Development Best Practices

  • 1. Cameron Tod - Solutions Architect, Acquia! @cam8001
  • 2. Who am I??? • From New Zealand (sorry for the accent) • Live in Hackney • Solutions Architect @ Acquia • A casual contributor to Drupal core • Maintain a few simple modules on d.o • Like to help new contributors as much as I can • cam8001 on drupal.org, IRC, Twitter
  • 3.
  • 4.
  • 5.
  • 7. The cli is your friend • Use git on command line. If this scares you, I can comfort you. • If you are on OS X - use brew! • If you are on Linux, use your package manager • If you are on Windows, try this https://drupal.org/ documentation/git/install
  • 8. First, git clone • Gets a complete copy of Drupal and all its history ██ cameron.tod @ kerbcrawler:~ 🍺 ██ 13:02:45 $ git clone --branch 8.x http://git.drupal.org/project/drupal.git Cloning into 'drupal'... remote: Counting objects: 319961, done. remote: Compressing objects: 100% (62618/62618), done. remote: Total 319961 (delta 223601), reused 317995 (delta 222129) Receiving objects: 100% (319961/319961), 74.74 MiB | 291.00 KiB/s, done. Resolving deltas: 100% (223601/223601), done. Checking connectivity... done ██ cameron.tod @ kerbcrawler:~/Sites/drupal (8.x) 🍺 ██ 01:13:34 $ git lg 008612ad4999138662a32abab2115cf3f03bca64 * 008612a - Imported sources (14 years ago) <Dries Buytaert>
  • 9. Our workflow 1. Create your issue branch 2. Make your changes 3. Stage your changes 4. Commit your changes 5. Make a patch file 6. Upload it to drupal.org for review
  • 10.
  • 11. Commit • A single changeset, relative to a repository and file system • Git stores commits as snapshots • Commit metadata; author, timestamp, message
  • 13. So what is a branch? • A branch is a stream of commits • A branch has full history • One repo can have many branches • You can branch at any point, or merge branches back together into a single history
  • 14. Files have 3 states • Committed • Modified • Staged
  • 15.
  • 16.
  • 17. 1. Create your issue branch Creates a new branch ██ cameron.tod @ kerbcrawler:~/Sites/drupal-pres (8.x) Branch name prefixed with issue number 🍺 ██ 15:47:07 $ git checkout -b 2091511-cache_form_expiry_to_variable Switched to a new branch '2091511-cache_form_expiry_to_variable' ! ██ cameron.tod @ kerbcrawler:~/Sites/drupal-pres (2091511-cache_form_expiry_to_variable) 🍺 ██ 15:47:13 $ ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 15:47:54 $ git branch * 2091511-cache_form_expiry_to_variable 8.x Brief description of the issue
  • 18. 2. Make your changes
  • 20. Modified state ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 00:40:39 $ git status # On branch 2091511-cache_form_expiry_to_variable # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: core/lib/Drupal/Core/Form/FormBuilder.php ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 00:42:09 $ git diff core/lib/Drupal/Core/Form/FormBuilder.php ! diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 49692d9..d70bf4f 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) { * {@inheritdoc} */ public function setCache($form_build_id, $form, $form_state) { // 6 hours cache life time for forms should be plenty. $expire = 21600; + $expire = Drupal::config('system.form')->get('cache_expire'); // Cache form structure. if (isset($form)) {
  • 21. 3. Stage your changes ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 01:53:46 $ git add core/lib/Drupal/Core/Form/FormBuilder.php ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) ██ 01:28:58 $ git status # On branch 2091511-cache_form_expiry_to_variable # Your branch is behind 'origin/8.x' by 17 commits, and can be fast-forwarded. # (use "git pull" to update your local branch) # # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: core/lib/Drupal/Core/Form/FormBuilder.php 🍺
  • 22. 4. Commit your changes ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 01:32:38 $ git commit -m 'Added form expiration as a config.' [2091511-cache_form_expiry_to_variable 7d1ca38] Added form expiration as a config. 1 file changed, 1 insertion(+), 2 deletions(-) ! ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 16:30:09 $ git lg * 22edfd2 - (HEAD, 2091511-cache_form_expiry_to_variable) Added form expiration as a config. (57 seconds ago) <Cameron Tod> * 5fb617d - Issue #1938926 by sun, Cottser, joelpittet, pplantinga: Convert simpletest theme tables to table #type. (21 hours ago) <Dries>
  • 23. 5. Make a patch file • A patch file is a commit changeset, saved in a text file • When you upload your patch to Drupal: • The testbots pick it up, apply the patch to Drupal core, and test it on qa.drupal.org • Other contributors can download it and apply it to their git repository
  • 24. $ git diff origin/8.x diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 49692d9..d70bf4f 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) { * {@inheritdoc} */ public function setCache($form_build_id, $form, $form_state) { // 6 hours cache life time for forms should be plenty. $expire = 21600; + $expire = Drupal::config('system.form')->get('cache_expire'); // Cache form structure. if (isset($form)) { $ git diff origin/8.x > 2091511-cache_form_expiry_to_variable-27.patch $ cat 2091511-cache_form_expiry_to_variable-27.patch diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 49692d9..d70bf4f 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -390,8 +390,7 @@ public function getCache($form_build_id, &$form_state) { * {@inheritdoc} */ public function setCache($form_build_id, $form, $form_state) { // 6 hours cache life time for forms should be plenty. $expire = 21600; + $expire = Drupal::config('system.form')->get('cache_expire'); // Cache form structure. if (isset($form)) {
  • 25. But don’t forget to rebase ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 22:52:22 $ git fetch remote: Counting objects: 857, done. remote: Compressing objects: 100% (234/234), done. remote: Total 534 (delta 334), reused 324 (delta 199) Receiving objects: 100% (534/534), 93.66 KiB | 0 bytes/s, done. Resolving deltas: 100% (334/334), completed with 225 local objects. From http://git.drupal.org/project/drupal 7d985d5..3ae51ab 8.x -> origin/8.x ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 22:54:12 $ git rebase origin/8.x First, rewinding head to replay your work on top of it... Applying: Added form expiration as a config. Applying: Adding closing newline to system.form.yml. Applying: Explicitly set cache expiry for cache_form. Applying: Moved form_cache expire setting into system_performance.yml. Applying: Added new config key to tests. Applying: Added config schema for new config key. Applying: Changed form cache expire key. Applying: Added config.factory stub to test. Applying: Added value to config factory stub. ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) 🍺 ██ 22:55:49 $ git lg * b23c13a - (HEAD, 2091511-cache_form_expiry_to_variable) Added value to config factory stub. (57 seconds ago) <Cameron Tod> * 0c2eec4 - Added config.factory stub to test. (57 seconds ago) <Cameron Tod> * 4df1959 - Changed form cache expire key. (57 seconds ago) <Cameron Tod> * e2f18d3 - Added config schema for new config key. (57 seconds ago) <Cameron Tod> * 0f54db6 - Added new config key to tests. (57 seconds ago) <Cameron Tod> * cef2510 - Moved form_cache expire setting into system_performance.yml. (57 seconds ago) <Cameron Tod> * 141ce4e - Explicitly set cache expiry for cache_form. (58 seconds ago) <Cameron Tod> * 9346d8e - Adding closing newline to system.form.yml. (58 seconds ago) <Cameron Tod> * 9408e2c - Added form expiration as a config. (58 seconds ago) <Cameron Tod> * 3ae51ab - (origin/HEAD, origin/8.x) Issue #2201149 by sidharthap, sandipmkhairnar: Remove comment_entity_info cache deletes. (11 hours ago) <Nathaniel Catchpole>
  • 26. Keep commits small $ git lg 668d277... * b23c13a - (HEAD, 2091511-cache_form_expiry_to_variable) Added value to config factory stub. (3 hours ago) <Cameron Tod> * 0c2eec4 - Added config.factory stub to test. (3 hours ago) <Cameron Tod> * 4df1959 - Changed form cache expire key. (3 hours ago) <Cameron Tod> * e2f18d3 - Added config schema for new config key. (3 hours ago) <Cameron Tod> * 0f54db6 - Added new config key to tests. (3 hours ago) <Cameron Tod> * cef2510 - Moved form_cache expire setting into system_performance.yml. (3 hours ago) <Cameron Tod> * 141ce4e - Explicitly set cache expiry for cache_form. (3 hours ago) <Cameron Tod> * 9346d8e - Adding closing newline to system.form.yml. (3 hours ago) <Cameron Tod> * 9408e2c - Added form expiration as a config. (3 hours ago) <Cameron Tod> * 3ae51ab - (origin/HEAD, origin/8.x) Issue #2201149 by sidharthap, sandipmkhairnar: Remove comment_entity_info cache deletes. (14 hours ago) <Nathaniel Catchpole>
  • 27. 6. Upload your patch for review
  • 28.
  • 29.
  • 30.
  • 31. If you remember one thing
  • 32. Branch per issue ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable) ██ 02:12:20 $ git branch 2084637-aggregator-test 2084637-service-container-automated-wrappers 2084637-service-container-automated-wrappers-foundation-only 2084637-service-container-with-get-prefix * 2091511-cache_form_expiry_to_variable 2205797-configmanager-unit-test 2205799-phpunit_consistent_config 8.x 8.x-SystemControllerTest-namespace maintenance-mode-cache-pages-1032936-fixes maintenance-mode-cache-pages-1032936-tests maintenance-mode-cache-pages-1032936-tests-travis 🍺
  • 33. Branches are cheap • Create ‘em like crazy! • They take no time at all!! • You can branch from any point! • Create one for every issue! • Remember, everything is a branch. And you can branch from a branch.! • Switch between branches quickly and easily! • No one else will ever see them. You can’t break Drupal core with git
  • 34. If you remember one (more) thing… • Everything is a branch • Everything is a branch • Everything is a branch • Every commit? A fully functional branch • Every tag? A branch. • Your remote upstream server (git.drupal.org)? A branch. Locally. • A branch?? A branch.
  • 35. Use case: test + fix branch $ git checkout maintenance-mode-cache-pages-1032936-fixes Checking out files: 100% (5288/5288), done. Switched to branch 'maintenance-mode-cache-pages-1032936-fixes' $ git checkout maintenance-mode-cache-pages-1032936-tests Switched to branch 'maintenance-mode-cache-pages-1032936-tests' $ git checkout -b maintenance-mode-cache-pages-1032936-tests+fixes Switched to a new branch 'maintenance-mode-cache-pages-1032936-tests+fixes' $ git merge maintenance-mode-cache-pages-1032936-fixes Merge made by the 'recursive' strategy. core/includes/bootstrap.inc | 5 ++++1 file changed, 4 insertions(+), 1 deletion(-)
  • 37. Apply a patch $ wget https://drupal.org/files/issues/2091511-cache_form_expiry_to_variable-27.patch --2014-03-01 03:06:00-- https://drupal.org/files/issues/2091511-cache_form_expiry_to_variable-27.patch Resolving drupal.org... 140.211.10.62, 140.211.10.16 Connecting to drupal.org|140.211.10.62|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2969 (2.9K) [text/plain] Saving to: ‘2091511-cache_form_expiry_to_variable-27.patch’ ! 100% [=========================================================================================================================================== ==================>] 2,969 --.-K/s in 0s ! 2014-03-01 03:06:01 (1.38 GB/s) - ‘2091511-cache_form_expiry_to_variable-27.patch’ saved [2969/2969] ! ! ! ██ cameron.tod @ kerbcrawler:~/Sites/drupal (2091511-cache_form_expiry_to_variable-presentation) 🍺 ██ 03:06:01 $ git apply -v --index 2091511-cache_form_expiry_to_variable-27.patch Checking patch core/lib/Drupal/Core/Form/FormBuilder.php... Checking patch core/modules/system/config/schema/system.schema.yml... Checking patch core/modules/system/config/system.performance.yml... Checking patch core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php... Checking patch core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php... Applied patch core/lib/Drupal/Core/Form/FormBuilder.php cleanly. Applied patch core/modules/system/config/schema/system.schema.yml cleanly. Applied patch core/modules/system/config/system.performance.yml cleanly. Applied patch core/modules/system/lib/Drupal/system/Tests/Form/FormCacheTest.php cleanly. Applied patch core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php cleanly. $ git commit -m 'Applied 2091511-cache_form_expiry_to_variable-27.patch' [2091511-cache_form_expiry_to_variable-presentation d4290d8] Applied 2091511-cache_form_expiry_to_variable-27.patch 5 files changed, 14 insertions(+), 3 deletions(-)
  • 38.
  • 39.
  • 40.
  • 42.
  • 44. Resources • https://drupal.org/project/drupal/git-instructions • http://drupalladder.org/ • Drush 7 for Drupal 8: https://github.com/drush-ops/drush • Show branch in prompt: http://www.neverstopbuilding.com/gitpro • Git Number: https://github.com/holygeek/git-number • git lg: https://coderwall.com/p/euwpig • D8 reset script: https://gist.github.com/cam8001/9270022 • Ask me! @cam8001
  • 45. Thank you! • Slides will be on http://2014.drupalcamplondon.co.uk/ • Come to Drupal monthly sprints at Techhub @ Campus, Shoreditch • We are hiring! Technical Architects, Devops, Technical Account Managers, Solutions Architects. Come and find me if you’re interested :)