]> Cypherpunks repositories - gostls13.git/commitdiff
codereview: fix clpatch
authorRuss Cox <rsc@golang.org>
Fri, 13 May 2011 03:11:52 +0000 (23:11 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 13 May 2011 03:11:52 +0000 (23:11 -0400)
TBR=gri
CC=golang-dev
https://golang.org/cl/4534052

lib/codereview/codereview.py

index 5fed5efdd0a51e5c886916ef91a5ebe2f6064fd6..f6e69a417f031875011a5e118c437131cbdcc9f9 100644 (file)
@@ -1336,8 +1336,6 @@ def clpatch_or_undo(ui, repo, clname, opts, mode):
                        return err
                if patch == emptydiff:
                        return "codereview issue %s has no diff" % clname
-               if not repo[vers]:
-                       return "codereview issue %s is newer than the current repository; hg sync" % clname
 
        # find current hg version (hg identify)
        ctx = repo[None]
@@ -1347,7 +1345,12 @@ def clpatch_or_undo(ui, repo, clname, opts, mode):
        # if version does not match the patch version,
        # try to update the patch line numbers.
        if vers != "" and id != vers:
-               if vers not in repo:
+               # "vers in repo" gives the wrong answer
+               # on some versions of Mercurial.  Instead, do the actual
+               # lookup and catch the exception.
+               try:
+                       repo[vers].description()
+               except:
                        return "local repository is out of date; sync to get %s" % (vers)
                patch, err = portPatch(repo, patch, vers, id)
                if err != "":