comparison mercurial/merge.py @ 22964:2793ecb1522d

manifest: repurpose flagsdiff() into (node-and-flag)diff() The manifestdict class already has a method for diff flags between two manifests (presumably because there is no full access to the private _flags field). The only caller is merge.manifestmerge(), which also wants a diff of files between the same manifests. Let's combine the code for diffing files and flags into a single method on manifestdict. This puts all the manifest diffing in one place and will allow for further simplification. It might also be useful for it to be encapsulated in manifestdict if we later decide to to shard manifests. The docstring is intentionally unclear about missing entries for now.
author Martin von Zweigbergk <martinvonz@gmail.com>
date Tue, 14 Oct 2014 17:09:16 -0700
parents ce0592328d68
children b697fa74b475
comparison
equal deleted inserted replaced
22963:56e04741bbf1 22964:2793ecb1522d
8 import struct 8 import struct
9 9
10 from node import nullid, nullrev, hex, bin 10 from node import nullid, nullrev, hex, bin
11 from i18n import _ 11 from i18n import _
12 from mercurial import obsolete 12 from mercurial import obsolete
13 import error as errormod, util, filemerge, copies, subrepo, worker, dicthelpers 13 import error as errormod, util, filemerge, copies, subrepo, worker
14 import errno, os, shutil 14 import errno, os, shutil
15 15
16 _pack = struct.pack 16 _pack = struct.pack
17 _unpack = struct.unpack 17 _unpack = struct.unpack
18 18
420 m1['.hgsubstate'] += "+" 420 m1['.hgsubstate'] += "+"
421 break 421 break
422 422
423 aborts = [] 423 aborts = []
424 # Compare manifests 424 # Compare manifests
425 fdiff = dicthelpers.diff(m1, m2) 425 diff = m1.diff(m2)
426 flagsdiff = m1.flagsdiff(m2) 426
427 diff12 = dicthelpers.join(fdiff, flagsdiff) 427 for f, (n12, fl12) in diff.iteritems():
428
429 for f, (n12, fl12) in diff12.iteritems():
430 if n12: 428 if n12:
431 n1, n2 = n12 429 n1, n2 = n12
432 else: # file contents didn't change, but flags did 430 else: # file contents didn't change, but flags did
433 n1 = n2 = m1.get(f, None) 431 n1 = n2 = m1.get(f, None)
434 if n1 is None: 432 if n1 is None: