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