merge: simplify merge tests, fix exec flag bug
authorMatt Mackall <mpm@selenic.com>
Thu, 27 Dec 2007 22:27:37 -0600
changeset 5700 9cedc3fbbebb
parent 5699 4cf5a4950fc9
child 5701 32c2832682a9
merge: simplify merge tests, fix exec flag bug If local changed exec bit and remote changed file contents, exec bit change would be lost.
mercurial/merge.py
--- a/mercurial/merge.py	Thu Dec 27 22:28:41 2007 +0100
+++ b/mercurial/merge.py	Thu Dec 27 22:27:37 2007 -0600
@@ -389,14 +389,18 @@
             # are files different?
             if n != m2[f]:
                 a = ma.get(f, nullid)
+                # are we clobbering?
+                if overwrite:
+                    act("clobbering", "g", f, m2.flags(f))
+                # or are we going back in time and clean?
+                elif backwards and not n[20:]:
+                    act("reverting", "g", f, m2.flags(f))
                 # are both different from the ancestor?
-                if not overwrite and n != a and m2[f] != a:
+                elif n != a and m2[f] != a:
                     act("versions differ", "m", f, f, f, fmerge(f), False)
-                # are we clobbering?
                 # is remote's version newer?
-                # or are we going back in time and clean?
-                elif overwrite or m2[f] != a or (backwards and not n[20:]):
-                    act("remote is newer", "g", f, m2.flags(f))
+                elif m2[f] != a:
+                    act("remote is newer", "g", f, fmerge(f))
                 # local is newer, not overwrite, check mode bits
                 elif fmerge(f) != m1.flags(f):
                     act("update permissions", "e", f, m2.flags(f))