comparison mercurial/merge.py @ 22965:b697fa74b475

manifest: for diff(), only iterate over files, not flags From manifest.diff(), we return a dict from filename to pairs of pairs of file nodeids and flags (values of the form ((n1,n2),(fl1,fl2))). To create this dict, we currently generate one dict for files (with (n1,n2) values) and one for flags (with (fl1,fl2) values) and then join these dicts. Missing files are represented by None and missing flags by '', but due to the dict joining, the inner pairs themselves can also be None. The only caller, merge.manifestmerge(), then unpacks these values while checking for None values. By inlining the calls to dicthelpers and simplifying it to only iterate over files (ignoring flags-only differences), we can simplify life for our caller.
author Martin von Zweigbergk <martinvonz@gmail.com>
date Tue, 14 Oct 2014 22:48:44 -0700
parents 2793ecb1522d
children ff93aa006e6a
comparison
equal deleted inserted replaced
22964:2793ecb1522d 22965:b697fa74b475
422 422
423 aborts = [] 423 aborts = []
424 # Compare manifests 424 # Compare manifests
425 diff = m1.diff(m2) 425 diff = m1.diff(m2)
426 426
427 for f, (n12, fl12) in diff.iteritems(): 427 for f, ((n1, n2), (fl1, fl2)) in diff.iteritems():
428 if n12:
429 n1, n2 = n12
430 else: # file contents didn't change, but flags did
431 n1 = n2 = m1.get(f, None)
432 if n1 is None:
433 # Since n1 == n2, the file isn't present in m2 either. This
434 # means that the file was removed or deleted locally and
435 # removed remotely, but that residual entries remain in flags.
436 # This can happen in manifests generated by workingctx.
437 continue
438 if fl12:
439 fl1, fl2 = fl12
440 else: # flags didn't change, file contents did
441 fl1 = fl2 = m1.flags(f)
442
443 if partial and not partial(f): 428 if partial and not partial(f):
444 continue 429 continue
445 if n1 and n2: 430 if n1 and n2:
446 fa = f 431 fa = f
447 a = ma.get(f, nullid) 432 a = ma.get(f, nullid)