812 "(see hg resolve)")) |
812 "(see hg resolve)")) |
813 wctx = context.workingctx(self, (p1, p2), text, user, date, |
813 wctx = context.workingctx(self, (p1, p2), text, user, date, |
814 extra, changes) |
814 extra, changes) |
815 ret = self.commitctx(wctx, editor, True) |
815 ret = self.commitctx(wctx, editor, True) |
816 ms.reset() |
816 ms.reset() |
|
817 |
|
818 # update dirstate |
|
819 for f in changes[0] + changes[1]: |
|
820 self.dirstate.normal(f) |
|
821 for f in changes[2]: |
|
822 self.dirstate.forget(f) |
|
823 self.dirstate.setparents(ret) |
|
824 |
817 return ret |
825 return ret |
818 |
826 |
819 finally: |
827 finally: |
820 if ret == None: |
828 if ret == None: |
821 self.dirstate.invalidate() # didn't successfully commit |
829 self.dirstate.invalidate() # didn't successfully commit |
822 wlock.release() |
830 wlock.release() |
823 |
831 |
824 def commitctx(self, ctx, editor=None, working=False): |
832 def commitctx(self, ctx, editor=None, error=False): |
825 """Add a new revision to current repository. |
833 """Add a new revision to current repository. |
826 |
834 |
827 Revision information is passed via the context argument. |
835 Revision information is passed via the context argument. |
828 If editor is supplied, it is called to get a commit message. |
836 If editor is supplied, it is called to get a commit message. |
829 If working is set, the working directory is affected. |
837 If working is set, the working directory is affected. |
853 try: |
861 try: |
854 fctx = ctx[f] |
862 fctx = ctx[f] |
855 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp, |
863 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp, |
856 changed) |
864 changed) |
857 m1.set(f, fctx.flags()) |
865 m1.set(f, fctx.flags()) |
858 if working: |
|
859 self.dirstate.normal(f) |
|
860 |
|
861 except (OSError, IOError): |
866 except (OSError, IOError): |
862 if working: |
867 if error: |
863 self.ui.warn(_("trouble committing %s!\n") % f) |
868 self.ui.warn(_("trouble committing %s!\n") % f) |
864 raise |
869 raise |
865 else: |
870 else: |
866 remove.append(f) |
871 remove.append(f) |
867 |
872 |