56 for fn in mf.keys(): |
56 for fn in mf.keys(): |
57 if not match(fn): |
57 if not match(fn): |
58 del mf[fn] |
58 del mf[fn] |
59 return mf |
59 return mf |
60 |
60 |
61 def diff(self, m2): |
61 def diff(self, m2, clean=False): |
62 '''Finds changes between the current manifest and m2. The result is |
62 '''Finds changes between the current manifest and m2. |
63 returned as a dict with filename as key and values of the form |
63 |
64 ((n1,fl1),(n2,fl2)), where n1/n2 is the nodeid in the current/other |
64 Args: |
65 manifest and fl1/fl2 is the flag in the current/other manifest. Where |
65 m2: the manifest to which this manifest should be compared. |
66 the file does not exist, the nodeid will be None and the flags will be |
66 clean: if true, include files unchanged between these manifests |
67 the empty string.''' |
67 with a None value in the returned dictionary. |
|
68 |
|
69 The result is returned as a dict with filename as key and |
|
70 values of the form ((n1,fl1),(n2,fl2)), where n1/n2 is the |
|
71 nodeid in the current/other manifest and fl1/fl2 is the flag |
|
72 in the current/other manifest. Where the file does not exist, |
|
73 the nodeid will be None and the flags will be the empty |
|
74 string. |
|
75 ''' |
68 diff = {} |
76 diff = {} |
69 |
77 |
70 for fn, n1 in self.iteritems(): |
78 for fn, n1 in self.iteritems(): |
71 fl1 = self._flags.get(fn, '') |
79 fl1 = self._flags.get(fn, '') |
72 n2 = m2.get(fn, None) |
80 n2 = m2.get(fn, None) |
73 fl2 = m2._flags.get(fn, '') |
81 fl2 = m2._flags.get(fn, '') |
74 if n2 is None: |
82 if n2 is None: |
75 fl2 = '' |
83 fl2 = '' |
76 if n1 != n2 or fl1 != fl2: |
84 if n1 != n2 or fl1 != fl2: |
77 diff[fn] = ((n1, fl1), (n2, fl2)) |
85 diff[fn] = ((n1, fl1), (n2, fl2)) |
|
86 elif clean: |
|
87 diff[fn] = None |
78 |
88 |
79 for fn, n2 in m2.iteritems(): |
89 for fn, n2 in m2.iteritems(): |
80 if fn not in self: |
90 if fn not in self: |
81 fl2 = m2._flags.get(fn, '') |
91 fl2 = m2._flags.get(fn, '') |
82 diff[fn] = ((None, ''), (n2, fl2)) |
92 diff[fn] = ((None, ''), (n2, fl2)) |