[PATCH 03 of 11] filectx: move size to basefilectx

Jun Wu quark at fb.com
Wed May 10 04:34:22 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1494384811 25200
#      Tue May 09 19:53:31 2017 -0700
# Node ID 86e994114f0e5971007b92af1aa7322c91c4cd16
# Parent  8fe9241cb76e0e1b91d6deaa9af81de3e97f696e
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 86e994114f0e
filectx: move size to basefilectx

See previous patch for context - avoid code duplication.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -802,4 +802,6 @@ class basefilectx(object):
     def repo(self):
         return self._repo
+    def size(self):
+        return len(self.data())
 
     def path(self):
@@ -2066,6 +2068,4 @@ class memfilectx(committablefilectx):
     def data(self):
         return self._data
-    def size(self):
-        return len(self.data())
 
     def remove(self, ignoremissing=False):


More information about the Mercurial-devel mailing list