Loading drush_make.project.inc +34 −2 Changes for drush_make.project.inc: 34 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -73,14 +73,47 @@ class DrushMakeProject { } // Download the patch. if ($filename = _drush_make_download_file($info)) { $patched = FALSE; $output = ''; // Test each patch style; -p1 is the default with git. See // http://drupal.org/node/1054616 $patch_levels = array('-p1', '-p0'); foreach ($patch_levels as $patch_level) { $checked = drush_shell_cd_and_exec($this->project_directory, 'GIT_WORK_TREE=. git apply --check %s %s', $patch_level, $filename); if ($checked) { // Apply the first successful style. $patched = drush_shell_cd_and_exec($this->project_directory, 'GIT_WORK_TREE=. git apply --verbose %s %s', $patch_level, $filename); break; } } // In some rare cases, git will fail to apply a patch, fallback to using // the 'patch -p0' command. if (!$patched) { $patched = drush_shell_exec("patch -p0 -d %s < %s", $this->project_directory, $filename); } if ($output = drush_shell_exec_output()) { // Log any command output, visible only in --verbose or --debug mode. drush_log(implode("\n", $output)); } // Set up string placeholders to pass to dt(). $dt_args = array( '@name' => $this->name, '@filename' => basename($filename), ); if ($patched) { if (!$ignore_checksums && !_drush_make_verify_checksums($info, $filename)) { return FALSE; } $patches_txt .= '- ' . $info['url'] . "\n"; drush_log(dt('@name patched with @filename.', $dt_args), 'ok'); } else { drush_log(dt("Unable to patch @name with @filename.", $dt_args), 'error'); } drush_log($this->name . ' patched with ' . basename($filename) . '.', $patched ? 'ok' : 'error'); drush_op('unlink', $filename); } else { Loading Loading @@ -325,4 +358,3 @@ class DrushMakeProject_Translation extends DrushMakeProject { } } } tests/patches.make +1 −1 Changes for tests/patches.make: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ api = 2 ; Test that patches work projects[token][version] = 1.13 projects[token][patch][] = http://drupal.org/files/issues/new_role_email_action5.patch projects[token][patch][] = http://drupal.org/files/issues/token_module_array_resolution_587148_01.patch No newline at end of file projects[token][patch][] = http://drupal.org/files/issues/587148-token-check-duplicate-tokens.patch tests/tests.info +2 −2 Changes for tests/tests.info: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ tests[no-patch-txt][name] = "Test --no-patch-txt option" tests[no-patch-txt][makefile] = "tests/patches.make" tests[no-patch-txt][messages][] = "Build hash: 24f14f6e28498678cebcab2cff3e1030" tests[no-patch-txt][messages][] = "Build hash: e2d38e343c7e95b994443c34ec665a23" tests[no-patch-txt][options][no-patch-txt] = TRUE tests[patch][name] = "Test patching and writing of PATCHES.txt file" tests[patch][makefile] = "tests/patches.make" tests[patch][messages][] = "Build hash: 173ae5e2120463e31ff2e2a9cc02491b" tests[patch][messages][] = "Build hash: c17e8b59055db741778f9048bf289332" tests[recursion][name] = "Recursion" tests[recursion][makefile] = "tests/recursion.make" Loading Loading
drush_make.project.inc +34 −2 Changes for drush_make.project.inc: 34 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -73,14 +73,47 @@ class DrushMakeProject { } // Download the patch. if ($filename = _drush_make_download_file($info)) { $patched = FALSE; $output = ''; // Test each patch style; -p1 is the default with git. See // http://drupal.org/node/1054616 $patch_levels = array('-p1', '-p0'); foreach ($patch_levels as $patch_level) { $checked = drush_shell_cd_and_exec($this->project_directory, 'GIT_WORK_TREE=. git apply --check %s %s', $patch_level, $filename); if ($checked) { // Apply the first successful style. $patched = drush_shell_cd_and_exec($this->project_directory, 'GIT_WORK_TREE=. git apply --verbose %s %s', $patch_level, $filename); break; } } // In some rare cases, git will fail to apply a patch, fallback to using // the 'patch -p0' command. if (!$patched) { $patched = drush_shell_exec("patch -p0 -d %s < %s", $this->project_directory, $filename); } if ($output = drush_shell_exec_output()) { // Log any command output, visible only in --verbose or --debug mode. drush_log(implode("\n", $output)); } // Set up string placeholders to pass to dt(). $dt_args = array( '@name' => $this->name, '@filename' => basename($filename), ); if ($patched) { if (!$ignore_checksums && !_drush_make_verify_checksums($info, $filename)) { return FALSE; } $patches_txt .= '- ' . $info['url'] . "\n"; drush_log(dt('@name patched with @filename.', $dt_args), 'ok'); } else { drush_log(dt("Unable to patch @name with @filename.", $dt_args), 'error'); } drush_log($this->name . ' patched with ' . basename($filename) . '.', $patched ? 'ok' : 'error'); drush_op('unlink', $filename); } else { Loading Loading @@ -325,4 +358,3 @@ class DrushMakeProject_Translation extends DrushMakeProject { } } }
tests/patches.make +1 −1 Changes for tests/patches.make: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ api = 2 ; Test that patches work projects[token][version] = 1.13 projects[token][patch][] = http://drupal.org/files/issues/new_role_email_action5.patch projects[token][patch][] = http://drupal.org/files/issues/token_module_array_resolution_587148_01.patch No newline at end of file projects[token][patch][] = http://drupal.org/files/issues/587148-token-check-duplicate-tokens.patch
tests/tests.info +2 −2 Changes for tests/tests.info: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -15,12 +15,12 @@ tests[no-patch-txt][name] = "Test --no-patch-txt option" tests[no-patch-txt][makefile] = "tests/patches.make" tests[no-patch-txt][messages][] = "Build hash: 24f14f6e28498678cebcab2cff3e1030" tests[no-patch-txt][messages][] = "Build hash: e2d38e343c7e95b994443c34ec665a23" tests[no-patch-txt][options][no-patch-txt] = TRUE tests[patch][name] = "Test patching and writing of PATCHES.txt file" tests[patch][makefile] = "tests/patches.make" tests[patch][messages][] = "Build hash: 173ae5e2120463e31ff2e2a9cc02491b" tests[patch][messages][] = "Build hash: c17e8b59055db741778f9048bf289332" tests[recursion][name] = "Recursion" tests[recursion][makefile] = "tests/recursion.make" Loading