Patchwork D6159: memfilectx: override copysource() instead of using dummy nodeid

login
register
mail settings
Submitter phabricator
Date March 20, 2019, 6:15 a.m.
Message ID <differential-rev-PHID-DREV-icqzcyd3eacwn24cfs6l-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39338/
State Superseded
Headers show

Comments

phabricator - March 20, 2019, 6:15 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The "_copied" property in basefilectx is used by renamed() and
  copysource(). committablefilectx (which memfilectx subclasses)
  overrides renamed() and writes it in terms of copysource() instead of
  _copied. That means that the nodeid part of "_copied" is memfilectx is
  unused. Let's instead override copysource() too so we don't need the
  "_copied".

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6159

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2393,9 +2393,10 @@ 
             self._flags = 'x'
         else:
             self._flags = ''
-        self._copied = None
-        if copysource:
-            self._copied = (copysource, nullid)
+        self._copysource = copysource
+
+    def copysource(self):
+        return self._copysource
 
     def cmp(self, fctx):
         return self.data() != fctx.data()