changeset 19604:ef7c47e4002f

basefilectx: move cmp from filectx
author Sean Farley <sean.michael.farley@gmail.com>
date Sun, 11 Aug 2013 22:56:53 -0500
parents a92302f48a56
children cf7322cb1c13
files mercurial/context.py
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Aug 11 22:56:30 2013 -0500
+++ b/mercurial/context.py	Sun Aug 11 22:56:53 2013 -0500
@@ -523,6 +523,21 @@
         except IOError:
             return False
 
+    def cmp(self, fctx):
+        """compare with other file context
+
+        returns True if different than fctx.
+        """
+        if (fctx._filerev is None
+            and (self._repo._encodefilterpats
+                 # if file data starts with '\1\n', empty metadata block is
+                 # prepended, which adds 4 bytes to filelog.size().
+                 or self.size() - 4 == fctx.size())
+            or self.size() == fctx.size()):
+            return self._filelog.cmp(self._filenode, fctx.data())
+
+        return True
+
 class filectx(basefilectx):
     """A filecontext object makes access to data related to a particular
        filerevision convenient."""
@@ -583,21 +598,6 @@
     def size(self):
         return self._filelog.size(self._filerev)
 
-    def cmp(self, fctx):
-        """compare with other file context
-
-        returns True if different than fctx.
-        """
-        if (fctx._filerev is None
-            and (self._repo._encodefilterpats
-                 # if file data starts with '\1\n', empty metadata block is
-                 # prepended, which adds 4 bytes to filelog.size().
-                 or self.size() - 4 == fctx.size())
-            or self.size() == fctx.size()):
-            return self._filelog.cmp(self._filenode, fctx.data())
-
-        return True
-
     def renamed(self):
         """check if file was actually renamed in this changeset revision