mq: handle empty patches more gracefully (issue1501)

This commit is contained in:
Matt Mackall 2009-02-16 17:37:23 -06:00
parent b649059d2b
commit 1a2d87e4e1
3 changed files with 10 additions and 11 deletions

View File

@ -551,9 +551,13 @@ class queue:
message.append(_("\nimported patch %s") % patchname) message.append(_("\nimported patch %s") % patchname)
message = '\n'.join(message) message = '\n'.join(message)
(patcherr, files, fuzz) = self.patch(repo, pf) if ph.haspatch:
all_files.update(files) (patcherr, files, fuzz) = self.patch(repo, pf)
patcherr = not patcherr all_files.update(files)
patcherr = not patcherr
else:
self.ui.warn(_("patch %s is empty\n") % patchname)
patcherr, files, fuzz = 0, [], 0
if merge and files: if merge and files:
# Mark as removed/merged and update dirstate parent info # Mark as removed/merged and update dirstate parent info
@ -583,12 +587,8 @@ class queue:
self.applied.append(statusentry(hex(n), patchname)) self.applied.append(statusentry(hex(n), patchname))
if patcherr: if patcherr:
if not ph.haspatch: self.ui.warn(_("patch failed, rejects left in working dir\n"))
self.ui.warn(_("patch %s is empty\n") % patchname) err = 1
err = 0
else:
self.ui.warn(_("patch failed, rejects left in working dir\n"))
err = 1
break break
if fuzz and strict: if fuzz and strict:

View File

@ -30,6 +30,7 @@ abort: cannot delete revision 2 above applied patches
now at: b now at: b
abort: unknown revision 'c'! abort: unknown revision 'c'!
applying c applying c
patch c is empty
now at: c now at: c
c c
3 imported patch c 3 imported patch c

View File

@ -486,8 +486,6 @@ patch queue now empty
abort: local changes found, refresh first abort: local changes found, refresh first
% apply force, should not discard changes with empty patch % apply force, should not discard changes with empty patch
applying empty applying empty
patch: **** Only garbage was found in the patch input.
patch failed, unable to continue (try -v)
patch empty is empty patch empty is empty
now at: empty now at: empty
diff -r bf5fc3f07a0a hello.txt diff -r bf5fc3f07a0a hello.txt