##// END OF EJS Templates
mq: fix error message for qpush inexistent-patch (issue1702)
Dirkjan Ochtman -
r8875:801cacf4 default
parent child Browse files
Show More
@@ -543,6 +543,8 b' class queue(object):'
543
543
544 def _apply(self, repo, series, list=False, update_status=True,
544 def _apply(self, repo, series, list=False, update_status=True,
545 strict=False, patchdir=None, merge=None, all_files={}):
545 strict=False, patchdir=None, merge=None, all_files={}):
546 '''returns (error, hash)
547 error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz'''
546 # TODO unify with commands.py
548 # TODO unify with commands.py
547 if not patchdir:
549 if not patchdir:
548 patchdir = self.path
550 patchdir = self.path
@@ -559,7 +561,7 b' class queue(object):'
559 try:
561 try:
560 ph = patchheader(self.join(patchname))
562 ph = patchheader(self.join(patchname))
561 except:
563 except:
562 self.ui.warn(_("Unable to read %s\n") % patchname)
564 self.ui.warn(_("unable to read %s\n") % patchname)
563 err = 1
565 err = 1
564 break
566 break
565
567
@@ -607,12 +609,12 b' class queue(object):'
607
609
608 if patcherr:
610 if patcherr:
609 self.ui.warn(_("patch failed, rejects left in working dir\n"))
611 self.ui.warn(_("patch failed, rejects left in working dir\n"))
610 err = 1
612 err = 2
611 break
613 break
612
614
613 if fuzz and strict:
615 if fuzz and strict:
614 self.ui.warn(_("fuzz found when applying patch, stopping\n"))
616 self.ui.warn(_("fuzz found when applying patch, stopping\n"))
615 err = 1
617 err = 3
616 break
618 break
617 return (err, n)
619 return (err, n)
618
620
@@ -953,6 +955,7 b' class queue(object):'
953 end = start + 1
955 end = start + 1
954 else:
956 else:
955 end = self.series.index(patch, start) + 1
957 end = self.series.index(patch, start) + 1
958
956 s = self.series[start:end]
959 s = self.series[start:end]
957 all_files = {}
960 all_files = {}
958 try:
961 try:
@@ -972,13 +975,15 b' class queue(object):'
972 util.unlink(repo.wjoin(f))
975 util.unlink(repo.wjoin(f))
973 self.ui.warn(_('done\n'))
976 self.ui.warn(_('done\n'))
974 raise
977 raise
978
975 top = self.applied[-1].name
979 top = self.applied[-1].name
976 if ret[0]:
980 if ret[0] and ret[0] > 1:
977 self.ui.write(_("errors during apply, please fix and "
981 msg = _("errors during apply, please fix and refresh %s\n")
978 "refresh %s\n") % top)
982 self.ui.write(msg % top)
979 else:
983 else:
980 self.ui.write(_("now at: %s\n") % top)
984 self.ui.write(_("now at: %s\n") % top)
981 return ret[0]
985 return ret[0]
986
982 finally:
987 finally:
983 wlock.release()
988 wlock.release()
984
989
@@ -45,3 +45,12 b' hg parents'
45
45
46 echo '% bar should be gone; other unknown/ignored files should still be around'
46 echo '% bar should be gone; other unknown/ignored files should still be around'
47 hg status -A
47 hg status -A
48
49 echo '% preparing qpush of a missing patch'
50 hg qpop -a
51 hg qpush
52 rm .hg/patches/patch2
53 echo '% now we expect the push to fail, but it should NOT complain about patch1'
54 hg qpush
55
56 true # happy ending
@@ -19,3 +19,11 b' summary: add foo'
19 ? untracked-file
19 ? untracked-file
20 I .hgignore
20 I .hgignore
21 C foo
21 C foo
22 % preparing qpush of a missing patch
23 no patches applied
24 applying patch1
25 now at: patch1
26 % now we expect the push to fail, but it should NOT complain about patch1
27 applying patch2
28 unable to read patch2
29 now at: patch1
General Comments 0
You need to be logged in to leave comments. Login now