X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/683840616efea425300859fe838add2b6b559a2c..d679e110f3641569dcf8562e9b378c671e86ae2d:/stgit/commands/common.py diff --git a/stgit/commands/common.py b/stgit/commands/common.py index bf804e6..78a364f 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -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():