Patchwork [03,of,11] filectx: move size to basefilectx

login
register
mail settings
Submitter Jun Wu
Date May 10, 2017, 8:34 a.m.
Message ID <86e994114f0e5971007b.1494405262@x1c>
Download mbox | patch
Permalink /patch/20549/
State Accepted
Headers show

Comments

Jun Wu - May 10, 2017, 8:34 a.m.
# HG changeset patch
# User Jun Wu <quark@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.

Patch

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