Debian Codegraph @

tests/test-mq-missingfiles.t

raw
1
2 Issue835: qpush fails immediately when patching a missing file, but
3 remaining added files are still created empty which will trick a
4 future qrefresh.
5
6 $ cat > writelines.py <<EOF
7 > import sys
8 > encode = lambda x: x.encode('utf-8').decode('unicode_escape').encode('utf-8')
9 > path = sys.argv[1]
10 > args = sys.argv[2:]
11 > assert (len(args) % 2) == 0
12 >
13 > f = open(path, 'wb')
14 > for i in range(len(args) // 2):
15 > count, s = args[2 * i:2 * i + 2]
16 > count = int(count)
17 > s = encode(s)
18 > f.write(s * count)
19 > f.close()
20 > EOF
21
22 $ echo "[extensions]" >> $HGRCPATH
23 $ echo "mq=" >> $HGRCPATH
24
25 $ hg init normal
26 $ cd normal
27 $ "$PYTHON" ../writelines.py b 10 'a\n'
28 $ hg ci -Am addb
29 adding b
30 $ echo a > a
31 $ "$PYTHON" ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n'
32 $ echo c > c
33 $ hg add a c
34 $ hg qnew -f changeb
35 $ hg qpop
36 popping changeb
37 patch queue now empty
38 $ hg rm b
39 $ hg ci -Am rmb
40
41 Push patch with missing target:
42
43 $ hg qpush
44 applying changeb
45 unable to find 'b' for patching
46 (use '--prefix' to apply patch relative to the current directory)
47 2 out of 2 hunks FAILED -- saving rejects to file b.rej
48 patch failed, unable to continue (try -v)
49 patch failed, rejects left in working directory
50 errors during apply, please fix and qrefresh changeb
51 [2]
52
53 Display added files:
54
55 $ cat a
56 a
57 $ cat c
58 c
59
60 Display rejections:
61
62 $ cat b.rej
63 --- b
64 +++ b
65 @@ -1,3 +1,5 @@
66 +b
67 +b
68 a
69 a
70 a
71 @@ -8,3 +10,5 @@
72 a
73 a
74 a
75 +c
76 +c
77
78 Test missing renamed file
79
80 $ hg qpop
81 popping changeb
82 patch queue now empty
83 $ hg up -qC 0
84 $ echo a > a
85 $ hg mv b bb
86 $ "$PYTHON" ../writelines.py bb 2 'b\n' 10 'a\n' 2 'c\n'
87 $ echo c > c
88 $ hg add a c
89 $ hg qnew changebb
90 $ hg qpop
91 popping changebb
92 patch queue now empty
93 $ hg up -qC 1
94 $ hg qpush
95 applying changebb
96 patching file bb
97 Hunk #1 FAILED at 0
98 Hunk #2 FAILED at 7
99 2 out of 2 hunks FAILED -- saving rejects to file bb.rej
100 b not tracked!
101 patch failed, unable to continue (try -v)
102 patch failed, rejects left in working directory
103 errors during apply, please fix and qrefresh changebb
104 [2]
105 $ cat a
106 a
107 $ cat c
108 c
109 $ cat bb.rej
110 --- bb
111 +++ bb
112 @@ -1,3 +1,5 @@
113 +b
114 +b
115 a
116 a
117 a
118 @@ -8,3 +10,5 @@
119 a
120 a
121 a
122 +c
123 +c
124
125 $ cd ..
126
127
128 $ echo "[diff]" >> $HGRCPATH
129 $ echo "git=1" >> $HGRCPATH
130
131 $ hg init git
132 $ cd git
133 $ "$PYTHON" ../writelines.py b 1 '\x00'
134 $ hg ci -Am addb
135 adding b
136 $ echo a > a
137 $ "$PYTHON" ../writelines.py b 1 '\x01' 1 '\x00'
138 $ echo c > c
139 $ hg add a c
140 $ hg qnew -f changeb
141 $ hg qpop
142 popping changeb
143 patch queue now empty
144 $ hg rm b
145 $ hg ci -Am rmb
146
147 Push git patch with missing target:
148
149 $ hg qpush
150 applying changeb
151 unable to find 'b' for patching
152 (use '--prefix' to apply patch relative to the current directory)
153 1 out of 1 hunks FAILED -- saving rejects to file b.rej
154 patch failed, unable to continue (try -v)
155 patch failed, rejects left in working directory
156 errors during apply, please fix and qrefresh changeb
157 [2]
158 $ hg st
159 ? b.rej
160
161 Display added files:
162
163 $ cat a
164 a
165 $ cat c
166 c
167
168 Display rejections:
169
170 $ cat b.rej
171 --- b
172 +++ b
173 GIT binary patch
174 literal 2
175 Jc${No0000400IC2
176
177 $ cd ..
178
179 Test push creating directory during git copy or rename:
180
181 $ hg init missingdir
182 $ cd missingdir
183 $ echo a > a
184 $ hg ci -Am adda
185 adding a
186 $ mkdir d
187 $ hg copy a d/a2
188 $ hg mv a d/a
189 $ hg qnew -g -f patch
190 $ hg qpop
191 popping patch
192 patch queue now empty
193 $ hg qpush
194 applying patch
195 now at: patch
196
197 $ cd ..
198