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>
diff --git a/gclient.py b/gclient.py
index 71ec2b1..fd67a29 100755
--- a/gclient.py
+++ b/gclient.py
@@ -1574,13 +1574,12 @@
       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:
+      if not patch_repo or not patch_ref or ':' not in patch_ref:
         raise gclient_utils.Error(
             'Wrong revision format: %s should be of the form '
-            '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_repo@target_branch:patch_ref.' % given_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
 
@@ -2598,7 +2597,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 '
@@ -2608,10 +2607,7 @@
                          '|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. 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.')
+                         'patch.')
   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 '