Constantly Contributing Pretty Patches FLCD

Preview:

Citation preview

Constantly ContributingPretty Patches

@teampoop

/in/markieslideshare.net/teampoop

Mark brings a fifteen year programming background and six years of Drupal experience to his role as Senior Drupal Developer at Mediacurrent. Highly involved in his local web community, Mark runs the ABQ Webgeeks Group and started the Albuquerque Drupal Users group.

Senior Drupal Developer - Mediacurrent

Shameless Self Promotion 1

Mediacurrent Dropcasthttps://www.mediacurrent.com/dropcastdropcast@mediacurrent.com

@kepford@imariohernandez@ryanissampson

Shameless Self Promotion 2

Mediacurrent Friday 55 things5 ways5 minutes on various topics.

Video (sorry)

Shameless Self Promotion 3

Hey come work with me!

Mediacurrent helps organizations build highly impactful, elegantly designed Drupal websites that achieve the strategic results they need.

● Single-source provider● Specializing in Drupal since 2007● Headquartered in Atlanta, GA● Team of 60+ Drupal Experts

including development, design and strategy

● Clients include: Large Enterprise and high-profile global brands

She’s my pal

This is DruLast thing about me.

Why We Contribute

Why a Good Patch

Create a Good Patch

Know your Module Maintainer

4

3

2

1

Use a Good Patch5

Living in the Future6

Why We Contribute

Come for the software,Stay for the community

~Drupal Project Motto

Why We Contribute

Every complaint is a contributor who needs guidance.

~Total misquote from @gregglesor was it @greggles who told me about it?

Why We Contribute

Know your Module Maintainer

• Probably not doing this full-time Probably working on something that puts food on the

table May not remember creating the project. May not exist (but that’s a different problem)

Know your Module Maintainer

Your module maintainer

Short story long:Not at your beck and

call!

Know your Module Maintainer

This does not apply to support requests. Thats

a different talk.

Know your Module Maintainer

Why a Good Patch

• Easier to review whats changed.Easy to apply to project.

Why make good patchesWhy a Good Patch

Things that make a module maintainer sad.

Why a Good Patch

Writing out requested code changes in the comments.

Why a Good Patch

Zipping up a changed project and uploading it to issue.

Why a Good Patch

Forking the project to Github or someplace and saying “check out my changes here”.

@Mediacurrent

Why a Good Patch

• No distinct code changes.

Can’t easily integrate into project.

More work for maintainer.

#Why are these bad?

Why a Good Patch

diff --git a/includes/jplayer.theme.inc b/includes/jplayer.theme.incindex 44a40c6..cb28394 100644--- a/includes/jplayer.theme.inc+++ b/includes/jplayer.theme.inc@@ -236,6 +236,7 @@ function jplayer_sort_files($raw_files = array(), $player_id = 0, $type = 'singl 'tabindex' => 1, 'onclick' => 'return(false);', ),+ 'html' => TRUE, ); if (isset($file) && $file['type'] == 'audio') { $files[][$file['ext']] = $file['url'];diff --git a/includes/jplayer_style_plugin.inc b/includes/jplayer_style_plugin.incindex b0b367b..329cb16 100644--- a/includes/jplayer_style_plugin.inc+++ b/includes/jplayer_style_plugin.inc@@ -112,7 +112,8 @@ class jplayer_style_plugin extends views_plugin_style { } $this->view->row_index = $row_index;- $label = trim(strip_tags($this->row_plugin->render($row)));+ $allowed_tags = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'span', 'div');+ $label = trim(filter_xss($this->row_plugin->render($row), $allowed_tags)); if (empty($label)) { $label = basename($filepath); }https://www.drupal.org/files/issues/allow_html_tags_in_playlist-1649102-4.patch

Why a Good Patch

• Distinct code changes.Can easily integrate into

project.Forever accessible to

the rest of the world.

#Why this is good?

Why a Good Patch

Creating a good Patch

Not an original thought!https://www.drupal.org/patch

Creating a Good Patch

Checkout the project.

Creating a Good Patch

git clone --branch 7.x-1.x http://git.drupal.org/project/colorbox.git

*branch and project name may vary

Creating a Good Patch

Check Out the Project

Create a new, feature branch.git checkout -b [issue-number]-[issue-description]

Why?

Creating a Good Patch

Make your awesome changes.

work /commit work / commit       work /commit

Creating a Good Patch

Create patch from differences between your branch and the

development branch.git diff 7.x-1-x > [PROJECT]-[DESCRIPTION]-[ISSUE#]-[COMMENT].patch

*Development branch name may vary*Patch name format should NOT.

Creating a Good Patch

Seriously. Name your patches properly.

Creating a Good Patch

Present your awesome back to the project.

Creating a Good Patch

●Update issue to “Needs Review”.

●Document your changes.●Sometimes you gotta nag.

Using Patches

Still not an original thought!

https://www.drupal.org/patch/apply

Using a Patch

Checkout the project

Using a Patch

git clone --branch 7.x-1.x http://git.drupal.org/project/colorbox.git Didn’t we just see this?

Download Patch to folder.

Using a Patch

Apply the happy patches

Using a Patch

git apply -v path/file.patch

Damien says:

Using a Patch

patch -p1 path/file.patch

Note to self: get link to blogpost from Damien

Wait. Don’t Download!

Creating a Good Patch

curl https://www.drupal.org/files/issues/1307166-42.patch | patch -p1

Living in the Future

• Inline comments.

• Easier to pull from forked repos.

• Single button to merge changes.

Living in the Future

Pull requests instead of patches.

Hot-fix Security Updates

Living in the Future

Hot-fix Security UpdatesLiving in the Future

Living in the Future

Hot-fix security fixes

Living in the Future

Hot-fix security fixes

@Mediacurrent Mediacurrent.com

Thank you!

slideshare.net/mediacurrent

Constantly ContributingPretty Patches

Constantly ContributingPretty Patches