[PATCH 4 of 8] fileset: extract function that builds status tuple only if necessary

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Mar 3 08:40:41 EST 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1422094419 -32400
#      Sat Jan 24 19:13:39 2015 +0900
# Node ID 70a6ca02bb2d6b41202518bb1d761f7bef785f7e
# Parent  dcafd00afeb38478ea65a978b9ada91b4a6ac46b
# 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 70a6ca02bb2d
fileset: extract function that builds status tuple only if necessary

This function will be used to recalculate status when mctx.ctx is switched.

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -526,7 +526,9 @@ def _buildsubset(ctx, status):
 
 def getfileset(ctx, expr):
     tree = parse(expr)
+    return getset(fullmatchctx(ctx, _buildstatus(ctx, tree)), tree)
 
+def _buildstatus(ctx, tree):
     # do we need status info?
     if (_intree(_statuscallers, tree) or
         # Using matchctx.existing() on a workingctx requires us to check
@@ -536,12 +538,10 @@ def getfileset(ctx, expr):
         ignored = _intree(['ignored'], tree)
 
         r = ctx.repo()
-        status = r.status(ctx.p1(), ctx,
-                          unknown=unknown, ignored=ignored, clean=True)
+        return r.status(ctx.p1(), ctx,
+                        unknown=unknown, ignored=ignored, clean=True)
     else:
-        status = None
-
-    return getset(fullmatchctx(ctx, status), tree)
+        return None
 
 def prettyformat(tree):
     return parser.prettyformat(tree, ('string', 'symbol'))


More information about the Mercurial-devel mailing list