From patchwork Tue Mar 24 16:36:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1, of, 4, PoC, issue4497] fileset: extract function that builds initial subset from ctx or status From: Yuya Nishihara X-Patchwork-Id: 8233 Message-Id: To: mercurial-devel@selenic.com Date: Wed, 25 Mar 2015 01:36:44 +0900 # HG changeset patch # User Yuya Nishihara # Date 1427206249 -32400 # Tue Mar 24 23:10:49 2015 +0900 # Node ID ff7b8ab9d021d8cd4dd7884b939f4603a092cac8 # Parent 811a1842cfe5f632145912d9bf2dc859e6ee3eeb fileset: extract function that builds initial subset from ctx or status This function will be used to recalculate subset when mctx.ctx is switched. diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -490,6 +490,15 @@ def _intree(funcs, tree): 'symlink', ] +def _buildsubset(ctx, status): + if status: + subset = [] + for c in status: + subset.extend(c) + return subset + else: + return list(ctx.walk(ctx.match([]))) + def getfileset(ctx, expr): tree, pos = parse(expr) if (pos != len(expr)): @@ -507,13 +516,10 @@ def getfileset(ctx, expr): r = ctx.repo() status = r.status(ctx.p1(), ctx, unknown=unknown, ignored=ignored, clean=True) - subset = [] - for c in status: - subset.extend(c) else: status = None - subset = list(ctx.walk(ctx.match([]))) + subset = _buildsubset(ctx, status) return getset(matchctx(ctx, subset, status), tree) # tell hggettext to extract docstrings from these functions: