Add --use_src_head.

This flag is used in non-bisecting mode by Android llvm builder,
to use the HEAD of src_path directory as is,
without calling git_llvm_rev or get_llvm_hash.

BUG=None
TEST=None
Change-Id: I99f75936d85b969009df3648d4759ff98e63bd4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2037149
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Chih-Hung Hsieh <chh@google.com>
Commit-Queue: Chih-Hung Hsieh <chh@google.com>
Auto-Submit: Chih-Hung Hsieh <chh@google.com>
diff --git a/llvm_tools/patch_manager.py b/llvm_tools/patch_manager.py
index 82a73ed..3c83fa9 100755
--- a/llvm_tools/patch_manager.py
+++ b/llvm_tools/patch_manager.py
@@ -95,6 +95,13 @@
       'bisecting a patch (default: %(default)s) - only used for '
       '"bisect_patches"')
 
+  # Trust src_path HEAD and svn_version.
+  parser.add_argument(
+      '--use_src_head',
+      action='store_true',
+      help='Use the HEAD of src_path directory as is, not necessarily the same '
+      'as the svn_version of upstream.')
+
   # Add argument for the LLVM version to use for patch management.
   parser.add_argument(
       '--svn_version',
@@ -718,8 +725,9 @@
     # patches that fail to apply could successfully apply if HEAD's SVN version
     # was the same as 'svn_version'. In other words, HEAD's git hash should be
     # what is being updated to (e.g. LLVM_NEXT_HASH).
-    VerifyHEADIsTheSameAsSVNVersion(args_output.src_path,
-                                    args_output.svn_version)
+    if not args_output.use_src_head:
+      VerifyHEADIsTheSameAsSVNVersion(args_output.src_path,
+                                      args_output.svn_version)
   else:
     # `git bisect run` called this script.
     #