[PATCH 1 of 5] patch: use ctx.node() instead of bare node variable

Sean Farley sean.michael.farley at gmail.com
Fri Jun 13 18:56:02 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376503827 18000
#      Wed Aug 14 13:10:27 2013 -0500
# Node ID b8c00606fe83ee6ac806908fd48a182b1eb6f2e8
# Parent  0f73ed6293629f69aa2f01d8940e91faeded49ae
patch: use ctx.node() instead of bare node variable

Future patches will allow patch.diff to take a basectx so node1 (and node2)
could make hexfunc error out. Instead, we'll call the node function on the
context object directly.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1619,11 +1619,11 @@ def diff(repo, node1=None, node2=None, m
     if not modified and not added and not removed:
         return []
 
     revs = None
     hexfunc = repo.ui.debugflag and hex or short
-    revs = [hexfunc(node) for node in [node1, node2] if node]
+    revs = [hexfunc(node) for node in [ctx1.node(), ctx2.node()] if node]
 
     copy = {}
     if opts.git or opts.upgrade:
         copy = copies.pathcopies(ctx1, ctx2)
 


More information about the Mercurial-devel mailing list