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

login
register
mail settings
Submitter Matt Harbison
Date March 10, 2015, 2:34 a.m.
Message ID <988cae9297fd5c61bf0a.1425954855@Envy>
Download mbox | patch
Permalink /patch/7958/
State Superseded
Commit 9640820bc957301b49bb677a4aee181de8d8266b
Delegated to: Pierre-Yves David
Headers show

Comments

Matt Harbison - March 10, 2015, 2:34 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.

Patch

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: