# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@ens-lyon.org>
# Date 1488546486 -3600
#      Fri Mar 03 14:08:06 2017 +0100
# Node ID 9d6e733046b9aa7e2ded8c4207625fedcc2a8c04
# Parent  2d0e9bb0f121ebbd041abf2ad121a18f200f6206
# EXP-Topic filesetrev-func
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull 
https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 9d6e733046b9
fileset: allow to specify a basectx for status

This will be used for a predicates that defines the status range of a match.

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -566,17 +566,23 @@ def getfileset(ctx, expr):
     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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to