mq: explicitly updatedir() even if patch() fails

It already works that way in practice, and we intend to merge updatedir() into
patch().
This commit is contained in:
Patrick Mezard 2011-05-08 17:48:29 +02:00
parent 707c7fe40d
commit 2ab321beb7
3 changed files with 8 additions and 8 deletions

View File

@ -614,16 +614,18 @@ class queue(object):
patchfile: name of patch file'''
files = {}
try:
fuzz = patchmod.patch(patchfile, self.ui, strip=1, cwd=repo.root,
files=files, eolmode=None)
try:
fuzz = patchmod.patch(patchfile, self.ui, strip=1,
cwd=repo.root, files=files, eolmode=None)
finally:
files = cmdutil.updatedir(self.ui, repo, files)
return (True, files, fuzz)
except Exception, inst:
self.ui.note(str(inst) + '\n')
if not self.ui.verbose:
self.ui.warn(_("patch failed, unable to continue (try -v)\n"))
return (False, files, False)
return (True, files, fuzz)
def apply(self, repo, series, list=False, update_status=True,
strict=False, patchdir=None, merge=None, all_files=None):
wlock = lock = tr = None
@ -707,7 +709,6 @@ class queue(object):
p1, p2 = repo.dirstate.parents()
repo.dirstate.setparents(p1, merge)
files = cmdutil.updatedir(self.ui, repo, files)
match = cmdutil.matchfiles(repo, files or [])
n = repo.commit(message, ph.user, ph.date, match=match, force=True)
@ -2280,7 +2281,6 @@ def fold(ui, repo, *files, **opts):
(patchsuccess, files, fuzz) = q.patch(repo, pf)
if not patchsuccess:
raise util.Abort(_('error folding patch %s') % p)
cmdutil.updatedir(ui, repo, files)
if not message:
ph = patchheader(q.join(parent), q.plainmode)

View File

@ -335,7 +335,7 @@ def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
def updatedir(ui, repo, patches, similarity=0):
'''Update dirstate after patch application according to metadata'''
if not patches:
return
return []
copies = []
removes = set()
cfiles = patches.keys()

View File

@ -101,8 +101,8 @@ Push git patch with missing target:
applying changeb
unable to find 'b' for patching
1 out of 1 hunks FAILED -- saving rejects to file b.rej
patch failed, unable to continue (try -v)
b: No such file or directory
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh changeb
[2]