[PATCH 03 of 48 RFC] basefilectx: use basectx __str__ instead of duplicating logic

Sean Farley sean.michael.farley at gmail.com
Thu Sep 5 15:06:57 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1376591477 18000
#      Thu Aug 15 13:31:17 2013 -0500
# Node ID 242d2cb12423330b4ef6d8c26a5b1efa69d7fbae
# Parent  82e46067545bd19bb2f566059d425ec4fe108768
basefilectx: use basectx __str__ instead of duplicating logic

This change allows us to only rely on one place to convert a context to a
string which will help eliminate duplicate code in context.py

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -454,11 +454,11 @@
         except error.LookupError:
             # file is missing
             return False
 
     def __str__(self):
-        return "%s@%s" % (self.path(), short(self.node()))
+        return "%s@%s" % (self.path(), self._changectx)
 
     def __repr__(self):
         return "<%s %s>" % (type(self).__name__, str(self))
 
     def __hash__(self):


More information about the Mercurial-devel mailing list