changeset 31194:016c63d6658c

fileset: allow to specify a basectx for status This will be used for a predicates that defines the status range of a match.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 03 Mar 2017 14:08:06 +0100
parents 4140d49d2efb
children 6b098ac4542e
files mercurial/fileset.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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