From patchwork Tue Aug 19 22:56:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 8, RFC] committablectx: override hex() to return p1 hash with "+" suffix From: Yuya Nishihara X-Patchwork-Id: 5528 Message-Id: <5358071e65be2fd330b4.1408488979@mimosa> To: mercurial-devel@selenic.com Date: Wed, 20 Aug 2014 07:56:19 +0900 # HG changeset patch # User Yuya Nishihara # Date 1408183124 -32400 # Sat Aug 16 18:58:44 2014 +0900 # Node ID 5358071e65be2fd330b45d5989198101ae6b01d6 # Parent a24e178a381bc389079e7c09ffe21f757ba93029 committablectx: override hex() to return p1 hash with "+" suffix Originally hex() didn't work because node() is None. Since hex() is the method to return ascii representation of node(), it won't be problem to contain "+" character. This change can simplify annotation of working-directory revision. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1002,6 +1002,9 @@ class committablectx(basectx): def __nonzero__(self): return True + def hex(self): + return self._parents[0].hex() + "+" + def _buildflagfunc(self): # Create a fallback function for getting file flags when the # filesystem doesn't support them