Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 18818:a0bff3d4f67b
manifestmerge: rename n to n1 and n2
An upcoming patch will combine the two loops into one, so it's important to
distinguish between nodes in m1 and nodes in m2.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 24 Mar 2013 16:43:25 -0700 |
parents | 0705ad73e878 |
children | 381c0ef72a56 |
comparison
equal
deleted
inserted
replaced
18817:c760acc6f69d | 18818:a0bff3d4f67b |
---|---|
236 m1['.hgsubstate'] += "+" | 236 m1['.hgsubstate'] += "+" |
237 break | 237 break |
238 | 238 |
239 aborts, prompts = [], [] | 239 aborts, prompts = [], [] |
240 # Compare manifests | 240 # Compare manifests |
241 for f, n in m1.iteritems(): | 241 for f, n1 in m1.iteritems(): |
242 if partial and not partial(f): | 242 if partial and not partial(f): |
243 continue | 243 continue |
244 if f in m2: | 244 if f in m2: |
245 n2 = m2[f] | 245 n2 = m2[f] |
246 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) | 246 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) |
247 nol = 'l' not in fl1 + fl2 + fla | 247 nol = 'l' not in fl1 + fl2 + fla |
248 a = ma.get(f, nullid) | 248 a = ma.get(f, nullid) |
249 if n == n2 and fl1 == fl2: | 249 if n1 == n2 and fl1 == fl2: |
250 pass # same - keep local | 250 pass # same - keep local |
251 elif n2 == a and fl2 == fla: | 251 elif n2 == a and fl2 == fla: |
252 pass # remote unchanged - keep local | 252 pass # remote unchanged - keep local |
253 elif n == a and fl1 == fla: # local unchanged - use remote | 253 elif n1 == a and fl1 == fla: # local unchanged - use remote |
254 if n == n2: # optimization: keep local content | 254 if n1 == n2: # optimization: keep local content |
255 actions.append((f, "e", (fl2,), "update permissions")) | 255 actions.append((f, "e", (fl2,), "update permissions")) |
256 else: | 256 else: |
257 actions.append((f, "g", (fl2,), "remote is newer")) | 257 actions.append((f, "g", (fl2,), "remote is newer")) |
258 elif nol and n2 == a: # remote only changed 'x' | 258 elif nol and n2 == a: # remote only changed 'x' |
259 actions.append((f, "e", (fl2,), "update permissions")) | 259 actions.append((f, "e", (fl2,), "update permissions")) |
260 elif nol and n == a: # local only changed 'x' | 260 elif nol and n1 == a: # local only changed 'x' |
261 actions.append((f, "g", (fl1,), "remote is newer")) | 261 actions.append((f, "g", (fl1,), "remote is newer")) |
262 else: # both changed something | 262 else: # both changed something |
263 actions.append((f, "m", (f, f, False), "versions differ")) | 263 actions.append((f, "m", (f, f, False), "versions differ")) |
264 elif f in copied: # files we'll deal with on m2 side | 264 elif f in copied: # files we'll deal with on m2 side |
265 pass | 265 pass |
270 elif f in copy: | 270 elif f in copy: |
271 f2 = copy[f] | 271 f2 = copy[f] |
272 actions.append((f, "m", (f2, f, False), | 272 actions.append((f, "m", (f2, f, False), |
273 "local copied/moved to " + f2)) | 273 "local copied/moved to " + f2)) |
274 elif f in ma: # clean, a different, no remote | 274 elif f in ma: # clean, a different, no remote |
275 if n != ma[f]: | 275 if n1 != ma[f]: |
276 prompts.append((f, "cd")) # prompt changed/deleted | 276 prompts.append((f, "cd")) # prompt changed/deleted |
277 elif n[20:] == "a": # added, no remote | 277 elif n1[20:] == "a": # added, no remote |
278 actions.append((f, "f", None, "remote deleted")) | 278 actions.append((f, "f", None, "remote deleted")) |
279 else: | 279 else: |
280 actions.append((f, "r", None, "other deleted")) | 280 actions.append((f, "r", None, "other deleted")) |
281 | 281 |
282 for f, n in m2.iteritems(): | 282 for f, n2 in m2.iteritems(): |
283 if partial and not partial(f): | 283 if partial and not partial(f): |
284 continue | 284 continue |
285 if f in m1 or f in copied: # files already visited | 285 if f in m1 or f in copied: # files already visited |
286 continue | 286 continue |
287 if f in movewithdir: | 287 if f in movewithdir: |
318 "remote differs from untracked local")) | 318 "remote differs from untracked local")) |
319 elif not force and different: | 319 elif not force and different: |
320 aborts.append((f, "ud")) | 320 aborts.append((f, "ud")) |
321 else: | 321 else: |
322 actions.append((f, "g", (m2.flags(f),), "remote created")) | 322 actions.append((f, "g", (m2.flags(f),), "remote created")) |
323 elif n != ma[f]: | 323 elif n2 != ma[f]: |
324 prompts.append((f, "dc")) # prompt deleted/changed | 324 prompts.append((f, "dc")) # prompt deleted/changed |
325 | 325 |
326 for f, m in sorted(aborts): | 326 for f, m in sorted(aborts): |
327 if m == "ud": | 327 if m == "ud": |
328 repo.ui.warn(_("%s: untracked file differs\n") % f) | 328 repo.ui.warn(_("%s: untracked file differs\n") % f) |