Skip to content

Instantly share code, notes, and snippets.

@cafuego
Created May 2, 2013 00:25
Show Gist options
  • Save cafuego/5499387 to your computer and use it in GitHub Desktop.
Save cafuego/5499387 to your computer and use it in GitHub Desktop.
Allow drush_make to keep a working-copy of a project.
diff --git a/drush_make.orig/drush_make.download.inc b/drush_make/drush_make.download.inc
index 92c68f9..2bd0bb5 100644
--- a/drush_make.orig/drush_make.download.inc
+++ b/drush_make/drush_make.download.inc
@@ -345,6 +345,7 @@ function drush_make_download_post($name, $download, $download_location) {
function drush_make_download_git($name, $download, $download_location) {
$tmp_path = drush_make_tmp();
$wc = drush_get_option('working-copy');
+ $wc = (!empty($download['working-copy'])) ? $download['working-copy'] : $wc;
// check if branch option is set in info file, otherwise set default to master branch
$download['branch'] = isset($download['branch']) ? $download['branch'] : 'master';
@@ -500,6 +501,10 @@ function drush_make_download_git($name, $download, $download_location) {
}
function drush_make_download_bzr($name, $download, $download_location) {
+ $wc = drush_get_option('working-copy');
+ // Allow per-project working-copy to be specified in the Makefile.
+ $wc = (!empty($download['working-copy'])) ? $download['working-copy'] : $wc;
+
$tmp_path = drush_make_tmp();
$tmp_location = $tmp_path . '/__bzr__/' . basename($download_location);
drush_make_mkdir(dirname($tmp_location));
@@ -517,7 +522,7 @@ function drush_make_download_bzr($name, $download, $download_location) {
$args[] = $download['revision'];
}
$command .= ' %s %s';
- if (drush_get_option('working-copy')) {
+ if (!empty($wc)) {
$args[] = $download['url'];
$args[] = $tmp_location;
}
@@ -543,6 +548,10 @@ function drush_make_download_bzr($name, $download, $download_location) {
function drush_make_download_svn($name, $download, $download_location) {
+ $wc = drush_get_option('working-copy');
+ // Allow per-project working-copy to be specified in the Makefile.
+ $wc = (!empty($download['working-copy'])) ? $download['working-copy'] : $wc;
+
if (!empty($download['url'])) {
if (!empty($download['interactive'])) {
$function = 'drush_shell_exec_interactive';
@@ -554,7 +563,7 @@ function drush_make_download_svn($name, $download, $download_location) {
if (!isset($download['force']) || $download['force']) {
$options = ' --force';
}
- if (drush_get_option('working-copy')) {
+ if (!empty($wc)) {
$command = 'svn' . $options . ' checkout';
}
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment