##// END OF EJS Templates
qpush --move: move the right patch even with comment lines...
Gilles Moris -
r11715:4f9dfb54 stable
parent child Browse files
Show More
@@ -1051,12 +1051,16 b' class queue(object):'
1051 1051 self.check_localchanges(repo)
1052 1052
1053 1053 if move:
1054 try:
1055 index = self.series.index(patch, start)
1056 fullpatch = self.full_series[index]
1057 del self.full_series[index]
1058 except ValueError:
1059 raise util.Abort(_("patch '%s' not found") % patch)
1054 if not patch:
1055 raise util.Abort(_("please specify the patch to move"))
1056 for i, rpn in enumerate(self.full_series[start:]):
1057 # strip markers for patch guards
1058 if self.guard_re.split(rpn, 1)[0] == patch:
1059 break
1060 index = start + i
1061 assert index < len(self.full_series)
1062 fullpatch = self.full_series[index]
1063 del self.full_series[index]
1060 1064 self.full_series.insert(start, fullpatch)
1061 1065 self.parse_series()
1062 1066 self.series_dirty = 1
@@ -107,6 +107,11 b' cd a'
107 107
108 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 115 echo % qrefresh
111 116
112 117 echo a >> a
@@ -228,17 +233,29 b' hg qpush test1b.patch+1'
228 233
229 234 echo % qpush --move
230 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 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 242 hg qpush --move test.patch # noop move
234 243 hg qseries -v
235 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 250 hg qpush --move test1b.patch
238 251 hg qpush --move bogus # nonexistent patch
252 hg qpush --move # no patch
239 253 hg qpush --move test.patch # already applied
240 254 hg qpush
241 255
256 echo % series after move
257 cat `hg root`/.hg/patches/series
258
242 259 echo % pop, qapplied, qunapplied
243 260 hg qseries -v
244 261 echo % qapplied -1 test.patch
@@ -209,6 +209,8 b' popping test2.patch'
209 209 popping test1b.patch
210 210 popping test.patch
211 211 patch queue now empty
212 cannot push 'test2.patch' - guarded by ['+posguard']
213 number of unguarded, unapplied patches has changed from 2 to 3
212 214 applying test2.patch
213 215 now at: test2.patch
214 216 applying test1b.patch
@@ -222,14 +224,23 b' popping test.patch'
222 224 popping test1b.patch
223 225 popping test2.patch
224 226 patch queue now empty
227 guards deactivated
228 number of unguarded, unapplied patches has changed from 3 to 2
225 229 applying test.patch
226 230 now at: test.patch
227 231 applying test1b.patch
228 232 now at: test1b.patch
229 233 abort: patch bogus not in series
234 abort: please specify the patch to move
230 235 abort: cannot push to a previous patch: test.patch
231 236 applying test2.patch
232 237 now at: test2.patch
238 % series after move
239 test.patch
240 test1b.patch
241 test2.patch
242 # comment
243
233 244 % pop, qapplied, qunapplied
234 245 0 A test.patch
235 246 1 A test1b.patch
General Comments 0
You need to be logged in to leave comments. Login now