[PATCH 1 of 2 V2 STABLE] keyword: update filectx.cmp monkeypatch to handle '\1\n' at start of file

Christian Ebert blacktrash at gmx.net
Sun Jan 15 06:42:20 CST 2012


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1326631053 -3600
# Node ID 3fc1d029c987da66eb41eb89a9f56496379a85f1
# Parent  e5feebc1f3bb50f0180c76d31e8456a390a86c78
keyword: update filectx.cmp monkeypatch to handle '\1\n' at start of file

Analogous to 012b285cf643.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -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
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -162,13 +162,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


More information about the Mercurial-devel mailing list