comparison tests/test-mq @ 11715:4f9dfb54c8b5 stable

qpush --move: move the right patch even with comment lines 88fc876a4833 caused that we find the index of the moving patch in self.series but look it up in self.full_series. The difference between these is that full_series also contains comment lines, and we thus moved the wrong patch. Use back self.full_series to find the moving patch, but take care of striping the patch guard markers before comparing the patch name. Test cases have been added for comments and empty lines in self.full_series, and for the case of guarded patches. Original patch contributed by Mads Kiilerich <mads@kiilerich.com>
author Gilles Moris <gilles.moris@free.fr>
date Sat, 10 Jul 2010 21:23:00 +0200
parents d8d0fc3988ca
children
comparison
equal deleted inserted replaced
11712:9cbc62f68328 11715:4f9dfb54c8b5
105 105
106 cd a 106 cd a
107 107
108 hg qnew -m 'foo bar' test.patch 108 hg qnew -m 'foo bar' test.patch
109 109
110 echo '# comment' > .hg/patches/series.tmp
111 echo >> .hg/patches/series.tmp # empty line
112 cat .hg/patches/series >> .hg/patches/series.tmp
113 mv .hg/patches/series.tmp .hg/patches/series
114
110 echo % qrefresh 115 echo % qrefresh
111 116
112 echo a >> a 117 echo a >> a
113 hg qrefresh 118 hg qrefresh
114 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \ 119 sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1 x/" \
226 hg qpop test2.patch-2 231 hg qpop test2.patch-2
227 hg qpush test1b.patch+1 232 hg qpush test1b.patch+1
228 233
229 echo % qpush --move 234 echo % qpush --move
230 hg qpop -a 235 hg qpop -a
236 hg qguard test1b.patch -- -negguard
237 hg qguard test2.patch -- +posguard
238 hg qpush --move test2.patch # can't move guarded patch
239 hg qselect posguard
231 hg qpush --move test2.patch # move to front 240 hg qpush --move test2.patch # move to front
232 hg qpush --move test1b.patch 241 hg qpush --move test1b.patch # negative guard unselected
233 hg qpush --move test.patch # noop move 242 hg qpush --move test.patch # noop move
234 hg qseries -v 243 hg qseries -v
235 hg qpop -a 244 hg qpop -a
236 hg qpush --move test.patch # cleaning up 245 # cleaning up
246 hg qselect --none
247 hg qguard --none test1b.patch
248 hg qguard --none test2.patch
249 hg qpush --move test.patch
237 hg qpush --move test1b.patch 250 hg qpush --move test1b.patch
238 hg qpush --move bogus # nonexistent patch 251 hg qpush --move bogus # nonexistent patch
252 hg qpush --move # no patch
239 hg qpush --move test.patch # already applied 253 hg qpush --move test.patch # already applied
240 hg qpush 254 hg qpush
255
256 echo % series after move
257 cat `hg root`/.hg/patches/series
241 258
242 echo % pop, qapplied, qunapplied 259 echo % pop, qapplied, qunapplied
243 hg qseries -v 260 hg qseries -v
244 echo % qapplied -1 test.patch 261 echo % qapplied -1 test.patch
245 hg qapplied -1 test.patch 262 hg qapplied -1 test.patch