# HG changeset patch # User Matt Mackall # Date 1326475793 21600 # Node ID e5feebc1f3bb50f0180c76d31e8456a390a86c78 # Parent 031c2e4424e14e3a30b3e3dd5f9cbc169c110fcc# Parent 012b285cf643db07c52c694db0df82f51d8e4d27 merge with stable diff -r 031c2e4424e1 -r e5feebc1f3bb mercurial/context.py --- 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()) diff -r 031c2e4424e1 -r e5feebc1f3bb tests/test-status.t --- 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