Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 8875:801cacf46e62
mq: fix error message for qpush inexistent-patch (issue1702)
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 21 Jun 2009 17:34:33 +0200 |
parents | 14639c050251 |
children | 868670dbc237 |
line wrap: on
line diff
--- a/hgext/mq.py Sun Jun 21 16:54:57 2009 +0200 +++ b/hgext/mq.py Sun Jun 21 17:34:33 2009 +0200 @@ -543,6 +543,8 @@ def _apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, all_files={}): + '''returns (error, hash) + error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz''' # TODO unify with commands.py if not patchdir: patchdir = self.path @@ -559,7 +561,7 @@ try: ph = patchheader(self.join(patchname)) except: - self.ui.warn(_("Unable to read %s\n") % patchname) + self.ui.warn(_("unable to read %s\n") % patchname) err = 1 break @@ -607,12 +609,12 @@ if patcherr: self.ui.warn(_("patch failed, rejects left in working dir\n")) - err = 1 + err = 2 break if fuzz and strict: self.ui.warn(_("fuzz found when applying patch, stopping\n")) - err = 1 + err = 3 break return (err, n) @@ -953,6 +955,7 @@ end = start + 1 else: end = self.series.index(patch, start) + 1 + s = self.series[start:end] all_files = {} try: @@ -972,13 +975,15 @@ util.unlink(repo.wjoin(f)) self.ui.warn(_('done\n')) raise + top = self.applied[-1].name - if ret[0]: - self.ui.write(_("errors during apply, please fix and " - "refresh %s\n") % top) + if ret[0] and ret[0] > 1: + msg = _("errors during apply, please fix and refresh %s\n") + self.ui.write(msg % top) else: self.ui.write(_("now at: %s\n") % top) return ret[0] + finally: wlock.release()