Mercurial > public > mercurial-scm > hg-stable
diff hgext/mq.py @ 24826:9b02b678888e stable
mq: avoid silent failure when single patch doesn't apply (issue4604)
The error-handling here is quite byzantine. self._apply raises an
AbortNoCleanup, but self.apply was swallowing the exception and
returns 2. In self.push, we catch all exceptions.. and cleanup. We try
to print a message to clean up.. but that relies on having a
top-of-stack.
Instead, we re-raise the abort in self.apply, and avoid cleanup on
AbortNoCleanup in self.push by adding a trivial new except clause. We
also modernize the now-visible abort message.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 20 Apr 2015 18:13:44 -0500 |
parents | f1eaf03dd608 |
children | 58308ddea208 |
line wrap: on
line diff
--- a/hgext/mq.py Mon Apr 20 17:16:05 2015 +0200 +++ b/hgext/mq.py Mon Apr 20 18:13:44 2015 -0500 @@ -822,7 +822,7 @@ except AbortNoCleanup: tr.close() self.savedirty() - return 2, repo.dirstate.p1() + raise except: # re-raises try: tr.abort() @@ -880,7 +880,8 @@ touched = set(touched) & tobackup if touched and keepchanges: raise AbortNoCleanup( - _("local changes found, refresh first")) + _("conflicting local changes found"), + hint=_("did you forget to qrefresh?")) self.backup(repo, touched, copy=True) tobackup = tobackup - touched (patcherr, files, fuzz) = self.patch(repo, pf) @@ -1417,6 +1418,8 @@ else: ret = self.apply(repo, s, list, all_files=all_files, tobackup=tobackup, keepchanges=keepchanges) + except AbortNoCleanup: + raise except: # re-raises self.ui.warn(_('cleaning up working directory...')) node = repo.dirstate.p1()