[PATCH 1 of 2] context: narrow down filter special case in filectx.cmp()

Christian Ebert blacktrash at gmx.net
Thu Oct 14 16:40:50 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1287089270 -7200
# Node ID b8d25bf4d45c03cdb43124452eb4149261e95396
# Parent  80a3d1121c106fd972fa84423f55b2ce2e9407c9
context: narrow down filter special case in filectx.cmp()

cmp via filelog when encode filters are present, but only when
actually comparing to the working directory.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -357,10 +357,11 @@
 
         returns True if different than fctx.
         """
-        if not self._repo._encodefilterpats and self.size() != fctx.size():
-            return True
+        if (isinstance(fcxtx, workingfilectx) and self._repo._encodefilterpats
+            or self.size() == fctx.size()):
+            return self._filelog.cmp(self._filenode, fctx.data())
 
-        return self._filelog.cmp(self._filenode, fctx.data())
+        return True
 
     def renamed(self):
         """check if file was actually renamed in this changeset revision


More information about the Mercurial-devel mailing list