fileset: allow to specify a basectx for status
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 03 Mar 2017 14:08:06 +0100
changeset 31194 016c63d6658c
parent 31193 4140d49d2efb
child 31195 6b098ac4542e
fileset: allow to specify a basectx for status This will be used for a predicates that defines the status range of a match.
mercurial/fileset.py
--- 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