[issue428] mq: qpush silently empties files when binary files added in patch (qrefresh'ed with git diff)
Armando Singer
mercurial-bugs at selenic.com
Wed Nov 22 05:47:39 UTC 2006
New submission from Armando Singer <armando.singer at gmail.com>:
Below are some minimal test cases showing information loss when there
is more than 1 file added and there is at least 1 binary file.
This has been the case on the main hg repository for at least a few
weeks (resulting in many corrupted repositories here), but I've only
now been able to isolate as minimal tests. Also tested against the
latest crew e674cae8efee.
This is using git diffs for qrefresh.
First, a silent emptying of a file (this is the most common case we
get in real world scenarios):
$ hg init a && cd a
$ hg qinit
$ hg qnew -m "binary file test" p1
$ echo test > foo
$ find . -print0 > binary
$ ls -l
total 12
-rw-rw-r-- 1 asinger devel 192 Nov 21 21:12 binary
-rw-rw-r-- 1 asinger devel 5 Nov 21 21:12 foo
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:11 .hg/
$ hg add
adding binary
adding foo
$ hg qrefresh
$ ls -l
total 12
-rw-rw-r-- 1 asinger devel 192 Nov 21 21:12 binary
-rw-rw-r-- 1 asinger devel 5 Nov 21 21:12 foo
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:12 .hg/
$ cat .hg/patches/p1
binary file test
diff --git a/binary b/binary
new file mode 100644
index
0000000000000000000000000000000000000000..ce70eced439f979424ada207363cae6623f1e5fb
GIT binary patch
literal 192
zc${U7K at NZ*3<P~q!6#KI&_uyNIrw`;(L}jycBjq20LsRACU|$JGMuuY&@)l6)e=mE
t-?_3 at wVpi&M at w|Tjcq8ir~F;23Q7klare26uYAS8ma<&#i36s6H~=OJJVXEh
diff --git a/foo b/foo
new file mode 100644
--- /dev/null
+++ b/foo
@@ -0,0 +1,1 @@
+test
$ hg qpop
Patch queue now empty
$ hg qpush
applying p1
Now at: p1
$ ls -l
total 8
-rw-rw-r-- 1 asinger devel 192 Nov 21 21:12 binary
-rw-rw-r-- 1 asinger devel 0 Nov 21 21:12 foo
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:12 .hg/
Some other variations which show an error on qpush:
$ hg init b && cd b
$ hg qinit
$ hg qnew -m "binary add test 2" p1
$ head --bytes=4 /dev/zero > bin1
$ head --bytes=4 /dev/zero > bin2
$ hg add
adding bin1
adding bin2
$ hg qrefresh
$ ls -l
total 12
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:34 bin1
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:34 bin2
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:35 .hg/
$ cat .hg/patches/p1
binary add test 2
diff --git a/bin1 b/bin1
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
diff --git a/bin2 b/bin2
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
$ hg qpop
Patch queue now empty
$ hg qpush -v
applying p1
binary patch extraction failed
adding bin1
adding bin2
bin1
bin2
patch failed, rejects left in working dir
Errors during apply, please fix and refresh p1
$ ls -l
total 8
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:35 bin1
-rw-rw-r-- 1 asinger devel 0 Nov 21 21:35 bin2
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:35 .hg/
$ hg init c && cd c
$ hg qinit
$ hg qnew -m "binary add test" p1
$ head --bytes=4 /dev/zero > bin1
$ cp bin1 bin2
$ cp bin1 bin3
$ cp bin1 bin4
$ cp bin1 bin5
$ hg add
adding bin1
adding bin2
adding bin3
adding bin4
adding bin5
$ hg qrefresh
$ ls -l
total 24
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin1
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin2
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin3
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin4
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin5
drwxrwxr-x 4 asinger devel 4096 Nov 21 21:33 .hg/
$ cat .hg/patches/p1
binary add test
diff --git a/bin1 b/bin1
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
diff --git a/bin2 b/bin2
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
diff --git a/bin3 b/bin3
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
diff --git a/bin4 b/bin4
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
diff --git a/bin5 b/bin5
new file mode 100644
index
0000000000000000000000000000000000000000..593f4708db84ac8fd0f5cc47c634f38c013fe9e4
GIT binary patch
literal 4
Lc${NkU|;|M00aO5
$ hg qpop
Patch queue now empty
$ hg qpush
applying p1
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
Errors during apply, please fix and refresh p1
$ ls -l
total 16
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin1
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin2
-rw-rw-r-- 1 asinger devel 4 Nov 21 21:33 bin3
-rw-rw-r-- 1 asinger devel 0 Nov 21 21:33 bin4
-rw-rw-r-- 1 asinger devel 0 Nov 21 21:33 bin5
----------
messages: 2409
nosy: asinger
priority: bug
status: unread
title: mq: qpush silently empties files when binary files added in patch (qrefresh'ed with git diff)
topic: mq
____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue428>
____________________________________________________
More information about the Mercurial-devel
mailing list