mercurial/merge.py
changeset 2899 8743188f4d2e
parent 2898 db397c38005d
child 2968 545d33aa3f82
--- a/mercurial/merge.py	Tue Aug 15 22:46:35 2006 -0500
+++ b/mercurial/merge.py	Tue Aug 15 23:17:06 2006 -0500
@@ -254,11 +254,6 @@
         t = repo.file(f).read(node)
         repo.wwrite(f, t)
         util.set_exec(repo.wjoin(f), flag)
-        if not partial:
-            if branchmerge:
-                repo.dirstate.update([f], 'n', st_mtime=-1)
-            else:
-                repo.dirstate.update([f], 'n')
 
     # merge the tricky bits
     unresolved = []
@@ -271,7 +266,38 @@
         if ret:
             unresolved.append(f)
         util.set_exec(repo.wjoin(f), flag)
-        if not partial:
+
+    remove.sort()
+    for f in remove:
+        repo.ui.note(_("removing %s\n") % f)
+        util.audit_path(f)
+        try:
+            util.unlink(repo.wjoin(f))
+        except OSError, inst:
+            if inst.errno != errno.ENOENT:
+                repo.ui.warn(_("update failed to remove %s: %s!\n") %
+                             (f, inst.strerror))
+
+    # update dirstate
+    if not partial:
+        repo.dirstate.setparents(p1, p2)
+        repo.dirstate.forget(forget)
+        if branchmerge:
+            repo.dirstate.update(remove, 'r')
+        else:
+            repo.dirstate.forget(remove)
+
+        files = get.keys()
+        files.sort()
+        for f in files:
+            if branchmerge:
+                repo.dirstate.update([f], 'n', st_mtime=-1)
+            else:
+                repo.dirstate.update([f], 'n')
+
+        files = merge.keys()
+        files.sort()
+        for f in files:
             if branchmerge:
                 # We've done a branch merge, mark this file as merged
                 # so that we properly record the merger later
@@ -286,26 +312,6 @@
                 f_len = fl.size(fl.rev(other))
                 repo.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1)
 
-    remove.sort()
-    for f in remove:
-        repo.ui.note(_("removing %s\n") % f)
-        util.audit_path(f)
-        try:
-            util.unlink(repo.wjoin(f))
-        except OSError, inst:
-            if inst.errno != errno.ENOENT:
-                repo.ui.warn(_("update failed to remove %s: %s!\n") %
-                             (f, inst.strerror))
-    if not partial:
-        if branchmerge:
-            repo.dirstate.update(remove, 'r')
-        else:
-            repo.dirstate.forget(remove)
-
-    if not partial:
-        repo.dirstate.setparents(p1, p2)
-        repo.dirstate.forget(forget)
-
     if show_stats:
         stats = ((len(get), _("updated")),
                  (len(merge) - len(unresolved), _("merged")),