Hello,

I'm currently working on integrating Drupal with Gerrit & Jenkins.
I have already something working, you can see screenshots here: http://storify.com/drupol/gerrit-jenkins-aegir-and-drupal

I'm planning to make the full documentation when I have something working at 100%.

In a few words, when you push a commit into Gerrit, Jenkins is able to trigger a new build and test your patch.
If jenkins got a successful build, he can reports back to Gerrit, and like that, for each commit/push.
For that you need Drush to download a particular changeset (refspec in git).

Currently, Drush (download) is not able to download particular refspec.
My patch allows you to specify a new attribute to the download: the refspec.

Example:

projects[myprofile][type] = "profile"
projects[myprofile][download][type] = "git"
projects[myprofile][download][url] = git://gitserver/myprofile
projects[myprofile][download][refspec] = 'refs/changes/28/28/1'

The changes in the code are pretty simple, I test if the $download['refspec'] is not empty, and if so, I run two commands: git fetch and git checkout.

Also, if there is a refspec, it will have priority over other parameters such as branch, tag or revision.

Patch will follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pol’s picture

Patch for 6.x-2.x

moshe weitzman’s picture

Status: Needs review » Needs work

Looks like a useful patch. But we need patches against Drush5 which is where make lives now. It is no longer a separate project.

Pol’s picture

Status: Needs work » Needs review
FileSize
1.58 KB

Here it is for drush (master branch)

moshe weitzman’s picture

Version: All-versions-4.x-dev »
Category: task » feature
Status: Needs review » Needs work

Looks good, but needs a new test to be part of an existing test

jhedstrom’s picture

In addition to a test, it would be nice to update the README (in commands/make) to reflect this new functionality.

Pol’s picture

Voila, changes are made.
- Updated the README.
- Updated the makefile, so tests are done.

Pol’s picture

Status: Needs work » Needs review
Pol’s picture

Updated md5 in the testMake.php.

Thanks for the heads up @moshe weitzman !

Pol’s picture

Added more documentation in EXAMPLE.make.
Added a make_error() if we cannot fetch the refspec.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

I think the drush_log() for FETCH_HEAD should be for $type='info' so it does not show except for --verbose and higher. no need to change that unless you reroll for some other reason. otherwise, looks good.

Pol’s picture

rerolled to change $type = 'info'.

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

committed

dww’s picture

Pretty sure this broke the intent of #1371298: Rewrite .info files inside drush make when checking out from git to include version and project info and #1302820: Inject version info into .info file in git_drupalorg engine for tracking through *default* update report -- nothing in this patch does anything about .info file rewriting, but all that code depends on version, branch or tag being specified. That said, I'm not sure exactly what we *can* do for the .info file rewriting if you have a refspec like 'refs/changes/28/28/1'...

jhedstrom’s picture

@dww does it only break if a refspec is specified, or does this code break previously functional .info file rewriting?

dww’s picture

I just mean that if a refspec is specified, none of the .info file re-writing logic (at least as I wrote it) is going to work. So, I don't think this breaks any existing code. But, if you define a refspec, we're going to fail to re-write your .info files.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.