Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 14257:d035ede73434
mq: explicitly updatedir() even if patch() fails
It already works that way in practice, and we intend to merge updatedir() into
patch().
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 08 May 2011 17:48:29 +0200 |
parents | d04ba50e104d |
children | df9ccd39828c |
line wrap: on
line diff
--- a/hgext/mq.py Fri May 06 19:55:46 2011 +0300 +++ b/hgext/mq.py Sun May 08 17:48:29 2011 +0200 @@ -614,16 +614,18 @@ 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 @@ 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 @@ (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)