[PATCH 07 of 19] context: add _generatestatus method
Sean Farley
sean.michael.farley at gmail.com
Thu May 15 16:16:25 CDT 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1398134136 18000
# Mon Apr 21 21:35:36 2014 -0500
# Node ID 1ae1f9895dc54cceeafa95e095f19f936917d2fd
# Parent d49a306617e4a3fad4587c8e30ee71b80767011f
context: add _generatestatus method
This method is a copy of localstatus.status's core logic.
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -70,10 +70,35 @@ class basectx(object):
for fn in mf.keys():
if not match(fn):
del mf[fn]
return mf
+ def _generatestatus(self, other, s, match, listignored, listclean,
+ listunknown):
+ """generate a status with respect to another context"""
+ mf1 = other._manifestmatches(match, s)
+ mf2 = self._manifestmatches(match, s)
+
+ modified, added, clean = [], [], []
+ deleted, unknown, ignored = s[3], [], []
+ withflags = mf1.withflags() | mf2.withflags()
+ for fn, mf2node in mf2.iteritems():
+ if fn in mf1:
+ if (fn not in deleted and
+ ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
+ (mf1[fn] != mf2node and
+ (mf2node or self[fn].cmp(other[fn]))))):
+ modified.append(fn)
+ elif listclean:
+ clean.append(fn)
+ del mf1[fn]
+ elif fn not in deleted:
+ added.append(fn)
+ removed = mf1.keys()
+
+ return [modified, added, removed, deleted, unknown, ignored, clean]
+
@propertycache
def substate(self):
return subrepo.state(self, self._repo.ui)
def rev(self):
More information about the Mercurial-devel
mailing list