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

login
register
mail settings
Submitter Sean Farley
Date June 13, 2014, 11:56 p.m.
Message ID <b8c00606fe83ee6ac806.1402703762@laptop.local>
Download mbox | patch
Permalink /patch/5001/
State Accepted
Headers show

Comments

Sean Farley - June 13, 2014, 11:56 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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.
Matt Mackall - July 2, 2014, 4:52 p.m.
On Fri, 2014-06-13 at 16:56 -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1402700358 25200
> #      Fri Jun 13 15:59:18 2014 -0700
> # Node ID 5f7374fd04954f47b938195d618514ca9d65597f
> # Parent  9bb33f5b140fac3fbc4d97c18f7c17d36835ef15
> test-context: add test for performing a diff on a memctx

These are queued for default, thanks.

Patch

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)