chiark / gitweb /
Allow 'show' and 'id' to work on non-StGIT branches (bug #10011)
[stgit] / stgit / commands / common.py
index bf804e6763b720bf2d706ebbd26486563e608ddb..78a364fdee8d4831d4b039f034de5d41246148ee 100644 (file)
@@ -77,6 +77,14 @@ def git_id(crt_series, rev):
     """
     if not rev:
         return None
+
+    # try a GIT revision first
+    try:
+        return git.rev_parse(rev + '^{commit}')
+    except git.GitException:
+        pass
+
+    # try an StGIT patch name
     try:
         patch, branch, patch_id = parse_rev(rev)
         if branch == None:
@@ -103,7 +111,10 @@ def git_id(crt_series, rev):
             return series.get_base()
     except RevParseException:
         pass
-    return git.rev_parse(rev + '^{commit}')
+    except stack.StackException:
+        pass
+
+    raise CmdException, 'Unknown patch or revision: %s' % rev
 
 def check_local_changes():
     if git.local_changes():