[PATCH 2 of 4] keyword: use dirstate.parents to obtain current first parent

Christian Ebert blacktrash at gmx.net
Tue Jun 3 02:38:13 CDT 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1212320112 -7200
# Node ID e42fbc81cc4cdaf6d9ad45cf2fe45f509b9a49a1
# Parent  c045a0c134e4d404d663aaf41572e515ab96b7c9
keyword: use dirstate.parents to obtain current first parent

This should be quicker than changectx().node()

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -507,7 +507,7 @@
         comparing against working dir.'''
         if node2 is not None:
             kwt.matcher = util.never
-        elif node1 is not None and node1 != repo.changectx().node():
+        elif node1 is not None and node1 != repo.dirstate.parents()[0]:
             kwt.restrict = True
         patch_diff(repo, node1, node2, match, fp, changes, opts)
 


More information about the Mercurial-devel mailing list