Revert "gclient: Require a target ref when applying patches."
This reverts commit 1d6478a5ffed7d272a7910d678e0a35d2f9fd69b.
Reason for revert:
Skia doesn't pass target refs to patches yet.
Original change's description:
> gclient: Require a target ref when applying patches.
>
> Bug: 956807
> Change-Id: Icfffe965f9f4651f22e8ba32c60133a5620bb350
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1616804
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=tandrii@chromium.org,ehmaldonado@chromium.org
Change-Id: I96c7d4ab7df151f50e82f783ef1a8769890aef9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 956807
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623593
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/gclient.py b/gclient.py
index b510bcf..ad31662 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1574,12 +1574,13 @@
return patch_refs, target_branches
for given_patch_ref in self._options.patch_refs:
patch_repo, _, patch_ref = given_patch_ref.partition('@')
- if not patch_repo or not patch_ref or ':' not in patch_ref:
+ if not patch_repo or not patch_ref:
raise gclient_utils.Error(
'Wrong revision format: %s should be of the form '
- 'patch_repo@target_branch:patch_ref.' % given_patch_ref)
- target_branch, _, patch_ref = patch_ref.partition(':')
- target_branches[patch_repo] = target_branch
+ 'patch_repo@[target_branch:]patch_ref.' % given_patch_ref)
+ if ':' in patch_ref:
+ target_branch, _, patch_ref = patch_ref.partition(':')
+ target_branches[patch_repo] = target_branch
patch_refs[patch_repo] = patch_ref
return patch_refs, target_branches
@@ -2597,7 +2598,7 @@
parser.add_option('--patch-ref', action='append',
dest='patch_refs', metavar='GERRIT_REF', default=[],
help='Patches the given reference with the format '
- 'dep@target-ref:patch-ref. '
+ 'dep@[target-ref:]patch-ref. '
'For |dep|, you can specify URLs as well as paths, '
'with URLs taking preference. '
'|patch-ref| will be applied to |dep|, rebased on top '
@@ -2607,7 +2608,10 @@
'|target-ref| is the target branch against which a '
'patch was created, it is used to determine which '
'commits from the |patch-ref| actually constitute a '
- 'patch.')
+ 'patch. If not given, we will iterate over all remote '
+ 'branches and select one that contains the revision '
+ '|dep| is synced at. '
+ 'WARNING: |target-ref| will be mandatory soon.')
parser.add_option('--with_branch_heads', action='store_true',
help='Clone git "branch_heads" refspecs in addition to '
'the default refspecs. This adds about 1/2GB to a '