Revert "Reland "gclient: Require a target ref when applying patches.""
This reverts commit 822dbc51a298688c61e4dd8c40fbc714e1460663.
Reason for revert:
Skia autoroller is complaining
https://skia-review.googlesource.com/c/buildbot/+/219338
Original change's description:
> Reland "gclient: Require a target ref when applying patches."
>
> This is a reland of 1d6478a5ffed7d272a7910d678e0a35d2f9fd69b
>
> 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>
>
> Bug: 956807
> Change-Id: I3de8475a091ce6a2a14ff7dcfb92507a205ef78c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1623594
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
TBR=borenet@chromium.org,tandrii@chromium.org,ehmaldonado@chromium.org
Change-Id: I14a70206a34f7024abc21039806f23dc7cf56bb6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 956807
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1648321
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/gclient.py b/gclient.py
index fd67a29..71ec2b1 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 '