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

login
register
mail settings
Submitter Sean Farley
Date Sept. 5, 2013, 8:06 p.m.
Message ID <242d2cb12423330b4ef6.1378411617@laptop.local>
Download mbox | patch
Permalink /patch/2341/
State Accepted
Commit 86ce68c1ccb8db6a346a1827db5197851d0600ee
Headers show

Comments

Sean Farley - Sept. 5, 2013, 8:06 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@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

Patch

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):