changeset 15869:e5feebc1f3bb

merge with stable
author Matt Mackall <mpm@selenic.com>
date Fri, 13 Jan 2012 11:29:53 -0600
parents 031c2e4424e1 (current diff) 012b285cf643 (diff)
children a153a86a472c
files mercurial/context.py tests/test-status.t
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Jan 13 11:29:40 2012 -0600
+++ b/mercurial/context.py	Fri Jan 13 11:29:53 2012 -0600
@@ -385,7 +385,11 @@
 
         returns True if different than fctx.
         """
-        if (fctx._filerev is None and self._repo._encodefilterpats
+        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 fielog.size().
+                 or self.size() - 4 == fctx.size())
             or self.size() == fctx.size()):
             return self._filelog.cmp(self._filenode, fctx.data())
 
--- a/tests/test-status.t	Fri Jan 13 11:29:40 2012 -0600
+++ b/tests/test-status.t	Fri Jan 13 11:29:53 2012 -0600
@@ -272,3 +272,26 @@
     modified
   R removed
   C deleted
+
+  $ cd ..
+
+hg status of binary file starting with '\1\n', a separator for metadata:
+
+  $ hg init repo5
+  $ cd repo5
+  $ printf '\1\nfoo' > 010a
+  $ hg ci -q -A -m 'initial checkin'
+  $ hg status -A
+  C 010a
+
+  $ printf '\1\nbar' > 010a
+  $ hg status -A
+  M 010a
+  $ hg ci -q -m 'modify 010a'
+  $ hg status -A --rev 0:1
+  M 010a
+
+  $ touch empty
+  $ hg ci -q -A -m 'add another file'
+  $ hg status -A --rev 1:2 010a
+  C 010a