[PATCH 07 of 19] context: add _generatestatus method
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu May 15 19:09:41 CDT 2014
On 05/15/2014 02:16 PM, Sean Farley wrote:
> # 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]))))):
note: This if statement is very awful. I know it is not yours but If you
find time to clean it up someday; that would be great.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list