keyword: update filectx.cmp monkeypatch to handle '\1\n' at start of file stable
authorChristian Ebert <blacktrash@gmx.net>
Sun, 15 Jan 2012 13:37:33 +0100
branchstable
changeset 15871 07893690c435
parent 15870 f4c859293ed4
child 15872 a3e2b9a1f063
keyword: update filectx.cmp monkeypatch to handle '\1\n' at start of file Analogous to 012b285cf643.
hgext/keyword.py
tests/test-keyword.t
--- a/hgext/keyword.py	Wed Jan 11 16:54:29 2012 +0000
+++ b/hgext/keyword.py	Sun Jan 15 13:37:33 2012 +0100
@@ -680,7 +680,8 @@
         # not make sense
         if (fctx._filerev is None and
             (self._repo._encodefilterpats or
-             kwt.match(fctx.path()) and not 'l' in fctx.flags()) or
+             kwt.match(fctx.path()) and not 'l' in fctx.flags() or
+             self.size() - 4 == fctx.size()) or
             self.size() == fctx.size()):
             return self._filelog.cmp(self._filenode, fctx.data())
         return True
--- a/tests/test-keyword.t	Wed Jan 11 16:54:29 2012 +0000
+++ b/tests/test-keyword.t	Sun Jan 15 13:37:33 2012 +0100
@@ -160,13 +160,31 @@
   ignore $Id$
   a
 
-Test hook execution
-
   $ diff a hooktest
 
   $ cp $HGRCPATH.nohooks $HGRCPATH
   $ rm hooktest
 
+hg status of kw-ignored binary file starting with '\1\n'
+
+  $ printf '\1\nfoo' > i
+  $ hg -q commit -Am metasep i
+  $ hg status
+  $ printf '\1\nbar' > i
+  $ hg status
+  M i
+  $ hg -q commit -m "modify metasep" i
+  $ hg status --rev 2:3
+  M i
+  $ touch empty
+  $ hg -q commit -A -m "another file"
+  $ hg status -A --rev 3:4 i
+  C i
+
+  $ hg -q strip -n 2
+
+Test hook execution
+
 bundle
 
   $ hg bundle --base null ../kw.hg