##// 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 self.check_localchanges(repo)
1051 self.check_localchanges(repo)
1052
1052
1053 if move:
1053 if move:
1054 try:
1054 if not patch:
1055 index = self.series.index(patch, start)
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)
1056 fullpatch = self.full_series[index]
1062 fullpatch = self.full_series[index]
1057 del self.full_series[index]
1063 del self.full_series[index]
1058 except ValueError:
1059 raise util.Abort(_("patch '%s' not found") % patch)
1060 self.full_series.insert(start, fullpatch)
1064 self.full_series.insert(start, fullpatch)
1061 self.parse_series()
1065 self.parse_series()
1062 self.series_dirty = 1
1066 self.series_dirty = 1
@@ -107,6 +107,11 b' 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
@@ -228,17 +233,29 b' 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
241
255
256 echo % series after move
257 cat `hg root`/.hg/patches/series
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
@@ -209,6 +209,8 b' popping test2.patch'
209 popping test1b.patch
209 popping test1b.patch
210 popping test.patch
210 popping test.patch
211 patch queue now empty
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 applying test2.patch
214 applying test2.patch
213 now at: test2.patch
215 now at: test2.patch
214 applying test1b.patch
216 applying test1b.patch
@@ -222,14 +224,23 b' popping test.patch'
222 popping test1b.patch
224 popping test1b.patch
223 popping test2.patch
225 popping test2.patch
224 patch queue now empty
226 patch queue now empty
227 guards deactivated
228 number of unguarded, unapplied patches has changed from 3 to 2
225 applying test.patch
229 applying test.patch
226 now at: test.patch
230 now at: test.patch
227 applying test1b.patch
231 applying test1b.patch
228 now at: test1b.patch
232 now at: test1b.patch
229 abort: patch bogus not in series
233 abort: patch bogus not in series
234 abort: please specify the patch to move
230 abort: cannot push to a previous patch: test.patch
235 abort: cannot push to a previous patch: test.patch
231 applying test2.patch
236 applying test2.patch
232 now at: test2.patch
237 now at: test2.patch
238 % series after move
239 test.patch
240 test1b.patch
241 test2.patch
242 # comment
243
233 % pop, qapplied, qunapplied
244 % pop, qapplied, qunapplied
234 0 A test.patch
245 0 A test.patch
235 1 A test1b.patch
246 1 A test1b.patch
General Comments 0
You need to be logged in to leave comments. Login now