changeset 2894:f28f4c850cd8

merge: hoist some working manifest logic out of merge loop
author Matt Mackall <mpm@selenic.com>
date Tue, 15 Aug 2006 16:27:19 -0500
parents 3cef09d12010
children 21631c2c09a5
files mercurial/merge.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Tue Aug 15 16:12:51 2006 -0500
+++ b/mercurial/merge.py	Tue Aug 15 16:27:19 2006 -0500
@@ -116,8 +116,12 @@
     umap = dict.fromkeys(unknown)
 
     for f in added + modified + unknown:
-        mw[f] = None
-        if f in m1: mw[f] = "" # distinguish between changed and new
+        mw[f] = ""
+        # is the wfile new and matches m2?
+        if (f not in m1 and f in m2 and
+            not repo.file(f).cmp(m2[f], repo.wread(f))):
+            mw[f] = m2[f]
+
         mw.set(f, util.is_exec(repo.wjoin(f), mw.execf(f)))
 
     for f in deleted + removed:
@@ -139,11 +143,6 @@
         if f in m2:
             s = 0
 
-            # is the wfile new and matches m2?
-            if mw[f] == None:
-                if not repo.file(f).cmp(m2[f], repo.wread(f)):
-                    n = m2[f]
-
             # are files different?
             if n != m2[f]:
                 a = ma.get(f, nullid)