comparison hgext/mq.py @ 7782:140429276b63

mq: handle empty patches more gracefully (issue1501)
author Matt Mackall <mpm@selenic.com>
date Mon, 16 Feb 2009 17:37:23 -0600
parents 88887054d277
children d812029cda85 73d80d5bf478
comparison
equal deleted inserted replaced
7781:a45206455d85 7782:140429276b63
549 else: 549 else:
550 if list: 550 if list:
551 message.append(_("\nimported patch %s") % patchname) 551 message.append(_("\nimported patch %s") % patchname)
552 message = '\n'.join(message) 552 message = '\n'.join(message)
553 553
554 (patcherr, files, fuzz) = self.patch(repo, pf) 554 if ph.haspatch:
555 all_files.update(files) 555 (patcherr, files, fuzz) = self.patch(repo, pf)
556 patcherr = not patcherr 556 all_files.update(files)
557 patcherr = not patcherr
558 else:
559 self.ui.warn(_("patch %s is empty\n") % patchname)
560 patcherr, files, fuzz = 0, [], 0
557 561
558 if merge and files: 562 if merge and files:
559 # Mark as removed/merged and update dirstate parent info 563 # Mark as removed/merged and update dirstate parent info
560 removed = [] 564 removed = []
561 merged = [] 565 merged = []
581 585
582 if update_status: 586 if update_status:
583 self.applied.append(statusentry(hex(n), patchname)) 587 self.applied.append(statusentry(hex(n), patchname))
584 588
585 if patcherr: 589 if patcherr:
586 if not ph.haspatch: 590 self.ui.warn(_("patch failed, rejects left in working dir\n"))
587 self.ui.warn(_("patch %s is empty\n") % patchname) 591 err = 1
588 err = 0
589 else:
590 self.ui.warn(_("patch failed, rejects left in working dir\n"))
591 err = 1
592 break 592 break
593 593
594 if fuzz and strict: 594 if fuzz and strict:
595 self.ui.warn(_("fuzz found when applying patch, stopping\n")) 595 self.ui.warn(_("fuzz found when applying patch, stopping\n"))
596 err = 1 596 err = 1