Skip to content

Instantly share code, notes, and snippets.

@mikeyp
Last active April 21, 2018 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeyp/b4dc7db74b454bef788d to your computer and use it in GitHub Desktop.
Save mikeyp/b4dc7db74b454bef788d to your computer and use it in GitHub Desktop.
<?php
$queue = DrupalQueue::get('versioncontrol_reposync');
while ($item = $queue->claimItem()) {
try {
versioncontrol_reposync_run_worker($item->data);
$queue->deleteItem($item);
}
catch (Exception $e) {
watchdog_exception('cron', $e);
}
}

Clone a bare repo on disk:

git clone git://git.drupal.org/project/drupal.git drupal.git --bare

Update the Drupal project to point to your repo on disk

UPDATE versioncontrol_repositories set root = '/home/mikey_p/drupal.git' WHERE repo_id = 2;

Simulate a code push. Should use format: old-sha1 new-sha1 refs/heads/8.0.x

echo "8fcce5b381c8590238c2a0c73798d99b47e55392 ccfaa23e0a25ca8b6ba61f1b5ae076043dcc42fe refs/heads/8.0.x" | drush vc-nq --uid=1 --repo-id=2 --timestamp=1428000005

Check to see that it was queued in the versioncontrol_reposync queue:

select * from queue where name = 'versioncontrol_reposync';

Process the queue with a custom PHP script (see attached script) or cron:

drush -v php-script cron-queue.php

This will trigger hook_versioncontrol_code_arrival().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment