changeset 31189:3c32a3fdfd16

fileset: extract function that builds initial subset from ctx or status This function will be used to recalculate subset when mctx.ctx is switched.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 24 Mar 2015 23:10:49 +0900
parents ec5b56b50e19
children 2f881e7d1ade
files mercurial/fileset.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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):