[issue483] mq does not work under windows with gnu-win32 patch

Patrick Mézard mercurial-bugs at selenic.com
Sat Jan 20 04:35:48 CST 2007


New submission from Patrick Mézard <pmezard at gmail.com>:

Hello,

MQ behaviour is not consistent with encoding filters: hg produces diffs based on
files encoded versions while MQ apply them directly on the working directory,
which contains decoded versions. One manifestation of this is the use of MQ
under win32 with gnu-win32 patch utility.  Here are the result with different
combinations of win32text setup and --binary added to patch.patch() function:

test files pseudo-content:
f1 = """a\r\nb\r\nc"""
f2 = """a\r\nd\r\nc"""

pseudo-test script:
"""
hg init
cat ../f1 > f
hg commit -Am f1
cat ../f2 > f
hg commit -Am f2
hg qimport -r 1
hg qpop
hg qpush
cat f
"""

1. +win32text -binary => qpush fails
2. +win32text +binary => qpush succeeds, f is LF only
3. -win32text -binary => qpush fails
4. -win32text +binary => qpush succeeds, f is CR-LF

qpush failures come from hg diff generating binary diffs (at least diffs similar
to those of gnu-win32 diff with --binary) and patching them in non-binary mode.

Still, I think the problem is not with the patch utility but with the working
dir/revlog mismatch. The correct way to patch is to apply diffs on an encoded
version of working dir then decode the results back in working dir. I guess that
roundtripping on temporary files would be unacceptable for performance reasons
(are there similar issues in git ?). Maybe the incoming mpatch should take
encoding/decoding filters callbacks as arguments to avoid intermediate files.
This could introduce other problems since filters not always work in streaming mode.

Another solution would be to accept the situation as an MQ limitation and
document patch requirements and encoding filters impact thoroughly.

----------
messages: 2715
nosy: brendan, pmezard
priority: bug
status: unread
title: mq does not work under windows with gnu-win32 patch
topic: mq, windows

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue483>
____________________________________________________



More information about the Mercurial-devel mailing list