##// END OF EJS Templates
test-mq-qrefresh: test qrefresh when tip != qtip
Patrick Mezard -
r10367:b8801b58 stable
parent child Browse files
Show More
@@ -1,169 +1,194
1 1 #!/bin/sh
2 2
3 3 echo "[extensions]" >> $HGRCPATH
4 4 echo "mq=" >> $HGRCPATH
5 5
6 6 echo % init
7 7 hg init a
8 8 cd a
9 9
10 10 echo % commit
11 11 mkdir 1 2
12 12 echo 'base' > 1/base
13 13 echo 'base' > 2/base
14 14 hg ci -Ambase -d '1 0'
15 15
16 16 echo % qnew mqbase
17 17 hg qnew -mmqbase mqbase
18 18
19 19 echo % qrefresh
20 20 echo 'patched' > 1/base
21 21 echo 'patched' > 2/base
22 22 hg qrefresh
23 23
24 24 echo % qdiff
25 25 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
26 26 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
27 27
28 28 echo % qdiff dirname
29 29 hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
30 30 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
31 31
32 32 echo % patch file contents
33 33 cat .hg/patches/mqbase | \
34 34 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
35 35 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
36 36
37 37 echo % qrefresh 1
38 38 echo 'patched again' > base
39 39 hg qrefresh 1
40 40
41 41 echo % qdiff
42 42 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
43 43 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
44 44
45 45 echo % qdiff dirname
46 46 hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
47 47 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
48 48
49 49 echo % patch file contents
50 50 cat .hg/patches/mqbase | \
51 51 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
52 52 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
53 53
54 54 echo % qrefresh . in subdir
55 55 ( cd 1 ; hg qrefresh . )
56 56
57 57 echo % qdiff
58 58 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
59 59 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
60 60
61 61 echo % qdiff dirname
62 62 hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
63 63 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
64 64
65 65 echo % patch file contents
66 66 cat .hg/patches/mqbase | \
67 67 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
68 68 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
69 69
70 70 echo % qrefresh in hg-root again
71 71 hg qrefresh
72 72
73 73 echo % qdiff
74 74 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
75 75 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
76 76
77 77 echo % qdiff dirname
78 78 hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
79 79 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
80 80
81 81 echo % patch file contents
82 82 cat .hg/patches/mqbase | \
83 83 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
84 84 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
85 85
86 86 echo
87 87 echo % qrefresh --short tests:
88 88 echo 'orphan' > orphanchild
89 89 hg add orphanchild
90 90
91 91 echo % - add 1/base and 2/base one by one
92 92 hg qrefresh nonexistingfilename # clear patch
93 93 hg qrefresh --short 1/base
94 94 hg qrefresh --short 2/base
95 95
96 96 echo % -- qdiff output
97 97 hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
98 98 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
99 99
100 100 echo % -- patch file content
101 101 cat .hg/patches/mqbase | \
102 102 sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
103 103 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
104 104 hg st
105 105
106 106 echo % -- diff shows what is not in patch
107 107 hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
108 108 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
109 109 -e "s/^\(diff\).*/\1/"
110 110 echo % - before starting exclusive tests
111 111 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
112 112 echo % - exclude 2/base
113 113 hg qref -s -X 2/base
114 114 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
115 115 echo % -- status shows 2/base as dirty
116 116 hg st
117 117 echo % - remove 1/base and add 2/base again but not orphanchild
118 118 hg qref -s -X orphanchild -X 1/base 2/base orphanchild
119 119 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
120 120 echo % - add 1/base with include filter - and thus remove 2/base from patch
121 121 hg qref -s -I 1/ o* */*
122 122 sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
123 123 echo
124 124 cd ..
125 125
126 126 # Test qrefresh --git losing copy metadata
127 127 echo % create test repo
128 128 hg init repo
129 129 cd repo
130 130 echo "[diff]" >> .hg/hgrc
131 131 echo "git=True" >> .hg/hgrc
132 132 echo a > a
133 133 hg ci -Am adda
134 134 hg copy a ab
135 135 echo b >> ab
136 136 hg copy a ac
137 137 echo c >> ac
138 138 echo % capture changes
139 139 hg qnew -f p1
140 140 hg qdiff
141 141 echo % refresh and check changes again
142 142 hg qref
143 143 hg qdiff
144 144 cd ..
145 145
146 146 # Test issue 1441: qrefresh confused after hg rename
147 147 echo % issue1441 without git patches
148 148 hg init repo-1441
149 149 cd repo-1441
150 150 echo a > a
151 151 hg add a
152 152 hg qnew -f p
153 153 hg mv a b
154 154 hg qrefresh
155 155 hg qdiff --nodates
156 156 cd ..
157 157
158 echo '% issue2025: qrefresh does not honor filtering options when tip != qtip'
159 hg init repo-2025
160 cd repo-2025
161 echo a > a
162 echo b > b
163 hg ci -qAm addab
164 echo a >> a
165 echo b >> b
166 hg qnew -f patch
167 hg up -qC 0
168 echo c > c
169 hg ci -qAm addc
170 hg up -qC 1
171 echo '% refresh with tip != qtip'
172 hg --config diff.nodates=1 qrefresh -I b 2>&1 \
173 | sed 's/saving bundle.*/saving bundle.../g'
174 echo '% status after refresh'
175 hg st
176 echo '% b after refresh'
177 cat b
178 echo '% patch file after refresh'
179 cat .hg/patches/patch
180 cd ..
181
182
158 183 echo % issue1441 with git patches
159 184 hg init repo-1441-git
160 185 cd repo-1441-git
161 186 echo "[diff]" >> .hg/hgrc
162 187 echo "git=True" >> .hg/hgrc
163 188 echo a > a
164 189 hg add a
165 190 hg qnew -f p
166 191 hg mv a b
167 192 hg qrefresh
168 193 hg qdiff --nodates
169 194 cd .. No newline at end of file
@@ -1,268 +1,288
1 1 % init
2 2 % commit
3 3 adding 1/base
4 4 adding 2/base
5 5 % qnew mqbase
6 6 % qrefresh
7 7 % qdiff
8 8 diff -r b55ecdccb5cf 1/base
9 9 --- a/1/base
10 10 +++ b/1/base
11 11 @@ -1,1 +1,1 @@
12 12 -base
13 13 +patched
14 14 diff -r b55ecdccb5cf 2/base
15 15 --- a/2/base
16 16 +++ b/2/base
17 17 @@ -1,1 +1,1 @@
18 18 -base
19 19 +patched
20 20 % qdiff dirname
21 21 diff -r b55ecdccb5cf 1/base
22 22 --- a/1/base
23 23 +++ b/1/base
24 24 @@ -1,1 +1,1 @@
25 25 -base
26 26 +patched
27 27 diff -r b55ecdccb5cf 2/base
28 28 --- a/2/base
29 29 +++ b/2/base
30 30 @@ -1,1 +1,1 @@
31 31 -base
32 32 +patched
33 33 % patch file contents
34 34 mqbase
35 35
36 36 diff -r b55ecdccb5cf 1/base
37 37 --- a/1/base
38 38 +++ b/1/base
39 39 @@ -1,1 +1,1 @@
40 40 -base
41 41 +patched
42 42 diff -r b55ecdccb5cf 2/base
43 43 --- a/2/base
44 44 +++ b/2/base
45 45 @@ -1,1 +1,1 @@
46 46 -base
47 47 +patched
48 48 % qrefresh 1
49 49 % qdiff
50 50 diff -r b55ecdccb5cf 1/base
51 51 --- a/1/base
52 52 +++ b/1/base
53 53 @@ -1,1 +1,1 @@
54 54 -base
55 55 +patched
56 56 diff -r b55ecdccb5cf 2/base
57 57 --- a/2/base
58 58 +++ b/2/base
59 59 @@ -1,1 +1,1 @@
60 60 -base
61 61 +patched
62 62 % qdiff dirname
63 63 diff -r b55ecdccb5cf 1/base
64 64 --- a/1/base
65 65 +++ b/1/base
66 66 @@ -1,1 +1,1 @@
67 67 -base
68 68 +patched
69 69 diff -r b55ecdccb5cf 2/base
70 70 --- a/2/base
71 71 +++ b/2/base
72 72 @@ -1,1 +1,1 @@
73 73 -base
74 74 +patched
75 75 % patch file contents
76 76 mqbase
77 77
78 78 diff -r b55ecdccb5cf 1/base
79 79 --- a/1/base
80 80 +++ b/1/base
81 81 @@ -1,1 +1,1 @@
82 82 -base
83 83 +patched
84 84 % qrefresh . in subdir
85 85 % qdiff
86 86 diff -r b55ecdccb5cf 1/base
87 87 --- a/1/base
88 88 +++ b/1/base
89 89 @@ -1,1 +1,1 @@
90 90 -base
91 91 +patched
92 92 diff -r b55ecdccb5cf 2/base
93 93 --- a/2/base
94 94 +++ b/2/base
95 95 @@ -1,1 +1,1 @@
96 96 -base
97 97 +patched
98 98 % qdiff dirname
99 99 diff -r b55ecdccb5cf 1/base
100 100 --- a/1/base
101 101 +++ b/1/base
102 102 @@ -1,1 +1,1 @@
103 103 -base
104 104 +patched
105 105 diff -r b55ecdccb5cf 2/base
106 106 --- a/2/base
107 107 +++ b/2/base
108 108 @@ -1,1 +1,1 @@
109 109 -base
110 110 +patched
111 111 % patch file contents
112 112 mqbase
113 113
114 114 diff -r b55ecdccb5cf 1/base
115 115 --- a/1/base
116 116 +++ b/1/base
117 117 @@ -1,1 +1,1 @@
118 118 -base
119 119 +patched
120 120 % qrefresh in hg-root again
121 121 % qdiff
122 122 diff -r b55ecdccb5cf 1/base
123 123 --- a/1/base
124 124 +++ b/1/base
125 125 @@ -1,1 +1,1 @@
126 126 -base
127 127 +patched
128 128 diff -r b55ecdccb5cf 2/base
129 129 --- a/2/base
130 130 +++ b/2/base
131 131 @@ -1,1 +1,1 @@
132 132 -base
133 133 +patched
134 134 % qdiff dirname
135 135 diff -r b55ecdccb5cf 1/base
136 136 --- a/1/base
137 137 +++ b/1/base
138 138 @@ -1,1 +1,1 @@
139 139 -base
140 140 +patched
141 141 diff -r b55ecdccb5cf 2/base
142 142 --- a/2/base
143 143 +++ b/2/base
144 144 @@ -1,1 +1,1 @@
145 145 -base
146 146 +patched
147 147 % patch file contents
148 148 mqbase
149 149
150 150 diff -r b55ecdccb5cf 1/base
151 151 --- a/1/base
152 152 +++ b/1/base
153 153 @@ -1,1 +1,1 @@
154 154 -base
155 155 +patched
156 156 diff -r b55ecdccb5cf 2/base
157 157 --- a/2/base
158 158 +++ b/2/base
159 159 @@ -1,1 +1,1 @@
160 160 -base
161 161 +patched
162 162
163 163 % qrefresh --short tests:
164 164 % - add 1/base and 2/base one by one
165 165 % -- qdiff output
166 166 diff -r b55ecdccb5cf 1/base
167 167 --- a/1/base
168 168 +++ b/1/base
169 169 @@ -1,1 +1,1 @@
170 170 -base
171 171 +patched
172 172 diff -r b55ecdccb5cf 2/base
173 173 --- a/2/base
174 174 +++ b/2/base
175 175 @@ -1,1 +1,1 @@
176 176 -base
177 177 +patched
178 178 diff -r b55ecdccb5cf orphanchild
179 179 --- /dev/null
180 180 +++ b/orphanchild
181 181 @@ -0,0 +1,1 @@
182 182 +orphan
183 183 % -- patch file content
184 184 mqbase
185 185
186 186 diff -r b55ecdccb5cf 1/base
187 187 --- a/1/base
188 188 +++ b/1/base
189 189 @@ -1,1 +1,1 @@
190 190 -base
191 191 +patched
192 192 diff -r b55ecdccb5cf 2/base
193 193 --- a/2/base
194 194 +++ b/2/base
195 195 @@ -1,1 +1,1 @@
196 196 -base
197 197 +patched
198 198 A orphanchild
199 199 ? base
200 200 % -- diff shows what is not in patch
201 201 diff
202 202 --- /dev/null
203 203 +++ b/orphanchild
204 204 @@ -0,0 +1,1 @@
205 205 +orphan
206 206 % - before starting exclusive tests
207 207 1/base
208 208 2/base
209 209 % - exclude 2/base
210 210 1/base
211 211 % -- status shows 2/base as dirty
212 212 M 2/base
213 213 A orphanchild
214 214 ? base
215 215 % - remove 1/base and add 2/base again but not orphanchild
216 216 2/base
217 217 % - add 1/base with include filter - and thus remove 2/base from patch
218 218 1/base
219 219
220 220 % create test repo
221 221 adding a
222 222 % capture changes
223 223 diff --git a/a b/ab
224 224 copy from a
225 225 copy to ab
226 226 --- a/a
227 227 +++ b/ab
228 228 @@ -1,1 +1,2 @@
229 229 a
230 230 +b
231 231 diff --git a/a b/ac
232 232 copy from a
233 233 copy to ac
234 234 --- a/a
235 235 +++ b/ac
236 236 @@ -1,1 +1,2 @@
237 237 a
238 238 +c
239 239 % refresh and check changes again
240 240 diff --git a/a b/ab
241 241 copy from a
242 242 copy to ab
243 243 --- a/a
244 244 +++ b/ab
245 245 @@ -1,1 +1,2 @@
246 246 a
247 247 +b
248 248 diff --git a/a b/ac
249 249 copy from a
250 250 copy to ac
251 251 --- a/a
252 252 +++ b/ac
253 253 @@ -1,1 +1,2 @@
254 254 a
255 255 +c
256 256 % issue1441 without git patches
257 257 diff -r 000000000000 b
258 258 --- /dev/null
259 259 +++ b/b
260 260 @@ -0,0 +1,1 @@
261 261 +a
262 % issue2025: qrefresh does not honor filtering options when tip != qtip
263 % refresh with tip != qtip
264 saving bundle...
265 adding branch
266 adding changesets
267 adding manifests
268 adding file changes
269 added 1 changesets with 1 changes to 1 files
270 % status after refresh
271 M a
272 % b after refresh
273 b
274 b
275 % patch file after refresh
276 diff -r 1a60229be7ac b
277 --- a/b
278 +++ b/b
279 @@ -1,1 +1,2 @@
280 b
281 +b
262 282 % issue1441 with git patches
263 283 diff --git a/b b/b
264 284 new file mode 100644
265 285 --- /dev/null
266 286 +++ b/b
267 287 @@ -0,0 +1,1 @@
268 288 +a
General Comments 0
You need to be logged in to leave comments. Login now