fileset: extract function that builds initial subset from ctx or status
This function will be used to recalculate subset when mctx.ctx is switched.
--- a/mercurial/fileset.py Sat Jan 24 19:55:14 2015 +0900
+++ b/mercurial/fileset.py Tue Mar 24 23:10:49 2015 +0900
@@ -514,6 +514,15 @@
return True
return False
+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 = parse(expr)
@@ -528,13 +537,10 @@
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(fullmatchctx(ctx, subset, status), tree)
def prettyformat(tree):