resolve: move reset to localrepo.commit
authorMatt Mackall <mpm@selenic.com>
Mon, 16 Mar 2009 16:58:41 -0500
changeset 7848 89e05c02a4af
parent 7847 30cb79d84352
child 7849 d5662e939893
resolve: move reset to localrepo.commit This way rebase doesn't leave a stale resolve state
mercurial/commands.py
mercurial/localrepo.py
mercurial/merge.py
--- a/mercurial/commands.py	Mon Mar 16 16:58:41 2009 -0500
+++ b/mercurial/commands.py	Mon Mar 16 16:58:41 2009 -0500
@@ -645,9 +645,6 @@
     elif ui.verbose:
         ui.write(_('committed changeset %d:%s\n') % (rev,short(node)))
 
-    ms = merge_.mergestate(repo)
-    ms.reset(node)
-
 def copy(ui, repo, *pats, **opts):
     """mark files as copied for the next commit
 
--- a/mercurial/localrepo.py	Mon Mar 16 16:58:41 2009 -0500
+++ b/mercurial/localrepo.py	Mon Mar 16 16:58:41 2009 -0500
@@ -824,8 +824,11 @@
                                                     "(see hg resolve)"))
             wctx = context.workingctx(self, (p1, p2), text, user, date,
                                       extra, changes)
-            return self._commitctx(wctx, force, force_editor, empty_ok,
-                                   use_dirstate, update_dirstate)
+            r = self._commitctx(wctx, force, force_editor, empty_ok,
+                                use_dirstate, update_dirstate)
+            ms.reset()
+            return r
+
         finally:
             del lock, wlock
 
--- a/mercurial/merge.py	Mon Mar 16 16:58:41 2009 -0500
+++ b/mercurial/merge.py	Mon Mar 16 16:58:41 2009 -0500
@@ -14,9 +14,10 @@
     def __init__(self, repo):
         self._repo = repo
         self._read()
-    def reset(self, node):
+    def reset(self, node=None):
         self._state = {}
-        self._local = node
+        if node:
+            self._local = node
         shutil.rmtree(self._repo.join("merge"), True)
     def _read(self):
         self._state = {}