Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 8752:f177bdab261b
merge: simplify file revision comparison logic
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 08 Jun 2009 18:14:44 -0500 |
parents | e8d80e0835c7 |
children | af5f099d932b |
comparison
equal
deleted
inserted
replaced
8751:e8d80e0835c7 | 8752:f177bdab261b |
---|---|
172 for f, n in m1.iteritems(): | 172 for f, n in m1.iteritems(): |
173 if partial and not partial(f): | 173 if partial and not partial(f): |
174 continue | 174 continue |
175 if f in m2: | 175 if f in m2: |
176 rflags = fmerge(f, f, f) | 176 rflags = fmerge(f, f, f) |
177 # are files different? | 177 a = ma.get(f, nullid) |
178 if n != m2[f]: | 178 if n == m2[f] or m2[f] == a: # same or local newer |
179 a = ma.get(f, nullid) | 179 if m1.flags(f) != rflags: |
180 # is remote's version newer? | 180 act("update permissions", "e", f, rflags) |
181 if m2[f] != a: | 181 elif n == a: # remote newer |
182 # are both different from the ancestor? | 182 act("remote is newer", "g", f, rflags) |
183 if n != a: | 183 else: # both changed |
184 act("versions differ", "m", f, f, f, rflags, False) | 184 act("versions differ", "m", f, f, f, rflags, False) |
185 else: | 185 elif f in copied: # files we'll deal with on m2 side |
186 act("remote is newer", "g", f, rflags) | 186 pass |
187 continue | |
188 # contents don't need updating, check mode bits | |
189 if m1.flags(f) != rflags: | |
190 act("update permissions", "e", f, rflags) | |
191 elif f in copied: | |
192 continue | |
193 elif f in copy: | 187 elif f in copy: |
194 f2 = copy[f] | 188 f2 = copy[f] |
195 if f2 not in m2: # directory rename | 189 if f2 not in m2: # directory rename |
196 act("remote renamed directory to " + f2, "d", | 190 act("remote renamed directory to " + f2, "d", |
197 f, None, f2, m1.flags(f)) | 191 f, None, f2, m1.flags(f)) |
213 act("other deleted", "r", f) | 207 act("other deleted", "r", f) |
214 | 208 |
215 for f, n in m2.iteritems(): | 209 for f, n in m2.iteritems(): |
216 if partial and not partial(f): | 210 if partial and not partial(f): |
217 continue | 211 continue |
218 if f in m1: | 212 if f in m1 or f in copied: # files already visited |
219 continue | |
220 if f in copied: | |
221 continue | 213 continue |
222 if f in copy: | 214 if f in copy: |
223 f2 = copy[f] | 215 f2 = copy[f] |
224 if f2 not in m1: # directory rename | 216 if f2 not in m1: # directory rename |
225 act("local renamed directory to " + f2, "d", | 217 act("local renamed directory to " + f2, "d", |