1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:07:56 -07:00

codereview: fix clpatch

TBR=gri
CC=golang-dev
https://golang.org/cl/4534052
This commit is contained in:
Russ Cox 2011-05-12 23:11:52 -04:00
parent 14c59abd76
commit 71102ad25b

View File

@ -1336,8 +1336,6 @@ def clpatch_or_undo(ui, repo, clname, opts, mode):
return err return err
if patch == emptydiff: if patch == emptydiff:
return "codereview issue %s has no diff" % clname 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) # find current hg version (hg identify)
ctx = repo[None] ctx = repo[None]
@ -1347,7 +1345,12 @@ def clpatch_or_undo(ui, repo, clname, opts, mode):
# if version does not match the patch version, # if version does not match the patch version,
# try to update the patch line numbers. # try to update the patch line numbers.
if vers != "" and id != vers: 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) return "local repository is out of date; sync to get %s" % (vers)
patch, err = portPatch(repo, patch, vers, id) patch, err = portPatch(repo, patch, vers, id)
if err != "": if err != "":