[PATCH 2 of 3] files: use ctx object to access dirstate and rev

Matt Harbison mharbison72 at gmail.com
Mon Mar 9 21:34:15 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1425847529 14400
#      Sun Mar 08 16:45:29 2015 -0400
# Node ID 988cae9297fd5c61bf0a592cbb049f0a9277e210
# Parent  9ed5cdcf1f95c0ff2c52a27ebee2903fad969e00
files: use ctx object to access dirstate and rev

This allows the cmdutil method to take two fewer parameters.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3258,7 +3258,6 @@
 
     """
     ctx = scmutil.revsingle(repo, opts.get('rev'), None)
-    rev = ctx.rev()
     ret = 1
 
     end = '\n'
@@ -3268,9 +3267,9 @@
     fmt = '%s' + end
 
     matcher = scmutil.match(ctx, pats, opts)
-    ds = repo.dirstate
+    ds = ctx._repo.dirstate
     for f in ctx.matches(matcher):
-        if rev is None and ds[f] == 'r':
+        if ctx.rev() is None and ds[f] == 'r':
             continue
         formatter.startitem()
         if ui.verbose:


More information about the Mercurial-devel mailing list