mercurial/fileset.py
changeset 31204 016c63d6658c
parent 31203 4140d49d2efb
child 31205 6b098ac4542e
--- a/mercurial/fileset.py	Fri Mar 03 12:44:56 2017 +0100
+++ b/mercurial/fileset.py	Fri Mar 03 14:08:06 2017 +0100
@@ -566,17 +566,23 @@
     tree = parse(expr)
     return getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree)
 
-def _buildstatus(ctx, tree):
+def _buildstatus(ctx, tree, basectx=None):
     # do we need status info?
+
+    # temporaty boolean to simplify the next conditional
+    purewdir = ctx.rev() is None and basectx is None
+
     if (_intree(_statuscallers, tree) or
         # Using matchctx.existing() on a workingctx requires us to check
         # for deleted files.
-        (ctx.rev() is None and _intree(_existingcallers, tree))):
+        (purewdir and _intree(_existingcallers, tree))):
         unknown = _intree(['unknown'], tree)
         ignored = _intree(['ignored'], tree)
 
         r = ctx.repo()
-        return r.status(ctx.p1(), ctx,
+        if basectx is None:
+            basectx = ctx.p1()
+        return r.status(basectx, ctx,
                         unknown=unknown, ignored=ignored, clean=True)
     else:
         return None