Mercurial > hg-stable
changeset 23756:829f640b5540
manifest: add optional recording of clean entries to diff
This makes manifest slightly easier to use for status code.
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 15 Dec 2014 16:04:28 -0500 |
parents | d43948a910a5 |
children | b5346480a490 |
files | mercurial/manifest.py |
diffstat | 1 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/manifest.py Mon Dec 15 15:33:55 2014 -0500 +++ b/mercurial/manifest.py Mon Dec 15 16:04:28 2014 -0500 @@ -58,13 +58,21 @@ del mf[fn] return mf - def diff(self, m2): - '''Finds changes between the current manifest and m2. The result is - returned as a dict with filename as key and values of the form - ((n1,fl1),(n2,fl2)), where n1/n2 is the nodeid in the current/other - manifest and fl1/fl2 is the flag in the current/other manifest. Where - the file does not exist, the nodeid will be None and the flags will be - the empty string.''' + def diff(self, m2, clean=False): + '''Finds changes between the current manifest and m2. + + Args: + m2: the manifest to which this manifest should be compared. + clean: if true, include files unchanged between these manifests + with a None value in the returned dictionary. + + The result is returned as a dict with filename as key and + values of the form ((n1,fl1),(n2,fl2)), where n1/n2 is the + nodeid in the current/other manifest and fl1/fl2 is the flag + in the current/other manifest. Where the file does not exist, + the nodeid will be None and the flags will be the empty + string. + ''' diff = {} for fn, n1 in self.iteritems(): @@ -75,6 +83,8 @@ fl2 = '' if n1 != n2 or fl1 != fl2: diff[fn] = ((n1, fl1), (n2, fl2)) + elif clean: + diff[fn] = None for fn, n2 in m2.iteritems(): if fn not in self: