Mercurial > hg
comparison hgext/mq.py @ 14257:d035ede73434
mq: explicitly updatedir() even if patch() fails
It already works that way in practice, and we intend to merge updatedir() into
patch().
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 08 May 2011 17:48:29 +0200 |
parents | d04ba50e104d |
children | df9ccd39828c |
comparison
equal
deleted
inserted
replaced
14256:d04ba50e104d | 14257:d035ede73434 |
---|---|
612 def patch(self, repo, patchfile): | 612 def patch(self, repo, patchfile): |
613 '''Apply patchfile to the working directory. | 613 '''Apply patchfile to the working directory. |
614 patchfile: name of patch file''' | 614 patchfile: name of patch file''' |
615 files = {} | 615 files = {} |
616 try: | 616 try: |
617 fuzz = patchmod.patch(patchfile, self.ui, strip=1, cwd=repo.root, | 617 try: |
618 files=files, eolmode=None) | 618 fuzz = patchmod.patch(patchfile, self.ui, strip=1, |
619 cwd=repo.root, files=files, eolmode=None) | |
620 finally: | |
621 files = cmdutil.updatedir(self.ui, repo, files) | |
622 return (True, files, fuzz) | |
619 except Exception, inst: | 623 except Exception, inst: |
620 self.ui.note(str(inst) + '\n') | 624 self.ui.note(str(inst) + '\n') |
621 if not self.ui.verbose: | 625 if not self.ui.verbose: |
622 self.ui.warn(_("patch failed, unable to continue (try -v)\n")) | 626 self.ui.warn(_("patch failed, unable to continue (try -v)\n")) |
623 return (False, files, False) | 627 return (False, files, False) |
624 | |
625 return (True, files, fuzz) | |
626 | 628 |
627 def apply(self, repo, series, list=False, update_status=True, | 629 def apply(self, repo, series, list=False, update_status=True, |
628 strict=False, patchdir=None, merge=None, all_files=None): | 630 strict=False, patchdir=None, merge=None, all_files=None): |
629 wlock = lock = tr = None | 631 wlock = lock = tr = None |
630 try: | 632 try: |
705 for f in merged: | 707 for f in merged: |
706 repo.dirstate.merge(f) | 708 repo.dirstate.merge(f) |
707 p1, p2 = repo.dirstate.parents() | 709 p1, p2 = repo.dirstate.parents() |
708 repo.dirstate.setparents(p1, merge) | 710 repo.dirstate.setparents(p1, merge) |
709 | 711 |
710 files = cmdutil.updatedir(self.ui, repo, files) | |
711 match = cmdutil.matchfiles(repo, files or []) | 712 match = cmdutil.matchfiles(repo, files or []) |
712 n = repo.commit(message, ph.user, ph.date, match=match, force=True) | 713 n = repo.commit(message, ph.user, ph.date, match=match, force=True) |
713 | 714 |
714 if n is None: | 715 if n is None: |
715 raise util.Abort(_("repository commit failed")) | 716 raise util.Abort(_("repository commit failed")) |
2278 messages.append(ph.message) | 2279 messages.append(ph.message) |
2279 pf = q.join(p) | 2280 pf = q.join(p) |
2280 (patchsuccess, files, fuzz) = q.patch(repo, pf) | 2281 (patchsuccess, files, fuzz) = q.patch(repo, pf) |
2281 if not patchsuccess: | 2282 if not patchsuccess: |
2282 raise util.Abort(_('error folding patch %s') % p) | 2283 raise util.Abort(_('error folding patch %s') % p) |
2283 cmdutil.updatedir(ui, repo, files) | |
2284 | 2284 |
2285 if not message: | 2285 if not message: |
2286 ph = patchheader(q.join(parent), q.plainmode) | 2286 ph = patchheader(q.join(parent), q.plainmode) |
2287 message, user = ph.message, ph.user | 2287 message, user = ph.message, ph.user |
2288 for msg in messages: | 2288 for msg in messages: |