[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH: Re: [Monotone-devel] Problems with LF -> CRLF conversion under Wi
From: |
Emile Snyder |
Subject: |
PATCH: Re: [Monotone-devel] Problems with LF -> CRLF conversion under Windows |
Date: |
16 Apr 2005 11:10:29 -0700 |
On Fri, 2005-04-15 at 16:43, Maquelin, Olivier wrote:
> Been experimenting with Monotone version 0.18 under Windows. After
> updating to another revision, file contents suddenly disappeared
> (Scary!). After a bit of experimentation I found out that the contents
> could be recovered by disabling LF -> CRLF translation (Good, so at
> least I didn't loose any data...). Here is the info on how to
> reproduce the issue:
I don't have a fix, but I did write a testcase translation of these
steps. Please find below...
-emile
#
# add_file "tests/t_lf_crlf.at"
#
# patch "tests/t_lf_crlf.at"
# from []
# to [23948f7b8902c220666a561280b9eb34d1ccdd0e]
#
# patch "testsuite.at"
# from [14b8600c48fdafc19eba6942e2270738b4bd8c71]
# to [7b444a223e4b23052492b7e9881a50d0a563b77b]
#
--- tests/t_lf_crlf.at
+++ tests/t_lf_crlf.at
@@ -0,0 +1,43 @@
+AT_SETUP([use get_linesep_conv hook])
+
+MONOTONE_SETUP
+
+NEED_UNB64
+
+# This test excercises the common case of wanting to do newline
+# character conversion so that win32 users can have native line endings
+# in their working copies.
+
+
+# wrote files with 'foo\r\n' and 'foo\r\nfoo\r\n' and used mimencode
+# to generate the following b64 encoded contents.
+#
+# Note the newline before the closing ']', it's necessary.
+#
+AT_DATA(foo.lfcr.b64, [Zm9vDQo=
+])
+AT_DATA(foofoo.lfcr.b64, [Zm9vDQpmb28NCg==
+])
+
+UNB64(foo.lfcr.b64, foo.lfcr)
+UNB64(foofoo.lfcr.b64, foofoo.lfcr)
+
+AT_DATA(linesep.lua, [
+function get_linesep_conv(name)
+ return {"LF", "CRLF"}
+end
+])
+
+AT_CHECK(cp foo.lfcr foo, [], [ignore], [ignore])
+AT_CHECK(monotone --rcfile=test_hooks.lua --rcfile=linesep.lua add foo, [],
[ignore], [ignore])
+AT_CHECK(monotone --rcfile=test_hooks.lua --rcfile=linesep.lua --branch=foo
commit -m foo, [], [ignore], [ignore])
+FOO_REV=`BASE_REVISION`
+
+AT_CHECK(cp foofoo.lfcr foo, [], [ignore], [ignore])
+AT_CHECK(monotone --rcfile=test_hooks.lua --rcfile=linesep.lua commit -m
foofoo, [], [ignore], [ignore])
+FOO_FOO_REV=`BASE_REVISION`
+
+AT_CHECK(monotone --rcfile=test_hooks.lua --rcfile=linesep.lua update
$FOO_REV, [], [ignore], [ignore])
+AT_CHECK(cmp foo foo.lfcr, [], [ignore], [ignore])
+
+AT_CLEANUP
--- testsuite.at
+++ testsuite.at
@@ -551,3 +551,4 @@
m4_include(tests/t_netsync_largish_file.at)
m4_include(tests/t_update_off_branch.at)
m4_include(tests/t_setup_checkout_modify_new_dir.at)
+m4_include(tests/t_lf_crlf.at)
signature.asc
Description: This is a digitally signed message part