[PATCH 04 of 14 RFC] localrepo: use context.nodeorctx to reduce code

Sean Farley sean.michael.farley at gmail.com
Tue Jul 9 16:54:35 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1373323244 18000
#      Mon Jul 08 17:40:44 2013 -0500
# Node ID 399c9dd59e118005e37d0cf22f82fc5f7d9d2ab8
# Parent  6724e421bc24d936a6ce57ceb941612be4867d66
localrepo: use context.nodeorctx to reduce code

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1455,18 +1455,12 @@
             for fn in mf.keys():
                 if not match(fn):
                     del mf[fn]
             return mf
 
-        if isinstance(node1, context.changectx):
-            ctx1 = node1
-        else:
-            ctx1 = self[node1]
-        if isinstance(node2, context.changectx):
-            ctx2 = node2
-        else:
-            ctx2 = self[node2]
+        ctx1 = context.nodeorctx(self, node1)
+        ctx2 = context.nodeorctx(self, node2)
 
         working = ctx2.rev() is None
         parentworking = working and ctx1 == self['.']
         match = match or matchmod.always(self.root, self.getcwd())
         listignored, listclean, listunknown = ignored, clean, unknown


More information about the Mercurial-devel mailing list