Use commit:foo for looking up CLs by SHA1.

BUG=chromium:358381
TEST=Run with example CL that failed with trybots previously.

Change-Id: Ife47080fa1d03f23587076f8d83ebc5a9152c7df
Previous-Reviewed-on: https://chromium-review.googlesource.com/192510
(cherry picked from commit 48bd9ca9bf53fe123b8ea875920c90d96ef5ade1)
Reviewed-on: https://chromium-review.googlesource.com/192728
Reviewed-by: Yu-Ju Hong <yjhong@chromium.org>
Tested-by: Yu-Ju Hong <yjhong@chromium.org>
diff --git a/lib/gerrit.py b/lib/gerrit.py
index 2584c42..ea5fba9 100644
--- a/lib/gerrit.py
+++ b/lib/gerrit.py
@@ -210,6 +210,11 @@
         return [patch_dict]
       return [cros_patch.GerritPatch(patch_dict, self.remote, url_prefix)]
 
+    if change and git.IsSHA1(change, full=True):
+      # Use commit:sha1 for accurate query results (crbug.com/358381).
+      kwargs['commit'] = change
+      change = None
+
     if change and query_kwds.get('change'):
       raise GerritException('Bad query params: provided a change-id-like query,'
                             ' and a "change" search parameter')