##// END OF EJS Templates
mq: introduce qpop --check...
Patrick Mezard -
r16653:73b8c255 default
parent child Browse files
Show More
@@ -1299,7 +1299,9 b' class queue(object):'
1299 1299 wlock.release()
1300 1300
1301 1301 def pop(self, repo, patch=None, force=False, update=True, all=False,
1302 nobackup=False):
1302 nobackup=False, check=False):
1303 if force and check:
1304 raise util.Abort(_('cannot use both --force and --check'))
1303 1305 wlock = repo.wlock()
1304 1306 try:
1305 1307 if patch:
@@ -1346,9 +1348,12 b' class queue(object):'
1346 1348
1347 1349 tobackup = set()
1348 1350 if update:
1349 m, a, r, d = self.checklocalchanges(repo, force=force)
1350 if not nobackup and force:
1351 tobackup.update(m + a)
1351 m, a, r, d = self.checklocalchanges(repo, force=force or check)
1352 if force:
1353 if not nobackup:
1354 tobackup.update(m + a)
1355 elif check:
1356 tobackup.update(m + a + r + d)
1352 1357
1353 1358 self.applieddirty = True
1354 1359 end = len(self.applied)
@@ -1379,8 +1384,10 b' class queue(object):'
1379 1384 if d:
1380 1385 raise util.Abort(_("deletions found between repo revs"))
1381 1386
1382 # backup local changes in --force case
1383 self.backup(repo, set(a + m + r) & tobackup)
1387 tobackup = set(a + m + r) & tobackup
1388 if check and tobackup:
1389 self.localchangesfound()
1390 self.backup(repo, tobackup)
1384 1391
1385 1392 for f in a:
1386 1393 try:
@@ -2672,15 +2679,21 b' def push(ui, repo, patch=None, **opts):'
2672 2679 [('a', 'all', None, _('pop all patches')),
2673 2680 ('n', 'name', '',
2674 2681 _('queue name to pop (DEPRECATED)'), _('NAME')),
2682 ('c', 'check', None, _('tolerate non-conflicting local changes')),
2675 2683 ('f', 'force', None, _('forget any local changes to patched files')),
2676 2684 ('', 'no-backup', None, _('do not save backup copies of files'))],
2677 2685 _('hg qpop [-a] [-f] [PATCH | INDEX]'))
2678 2686 def pop(ui, repo, patch=None, **opts):
2679 2687 """pop the current patch off the stack
2680 2688
2681 By default, pops off the top of the patch stack. If given a patch
2682 name, keeps popping off patches until the named patch is at the
2683 top of the stack.
2689 Without argument, pops off the top of the patch stack. If given a
2690 patch name, keeps popping off patches until the named patch is at
2691 the top of the stack.
2692
2693 By default, abort if the working directory contains uncommitted
2694 changes. With -c/--check, abort only if the uncommitted files
2695 overlap with patched files. With -f/--force, backup and discard
2696 changes made to such files.
2684 2697
2685 2698 Return 0 on success.
2686 2699 """
@@ -2692,7 +2705,8 b' def pop(ui, repo, patch=None, **opts):'
2692 2705 else:
2693 2706 q = repo.mq
2694 2707 ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate,
2695 all=opts.get('all'), nobackup=opts.get('no_backup'))
2708 all=opts.get('all'), nobackup=opts.get('no_backup'),
2709 check=opts.get('check'))
2696 2710 q.savedirty()
2697 2711 return ret
2698 2712
@@ -202,6 +202,42 b' test qpop --force --no-backup'
202 202 $ test -f a.orig && echo 'error: backup with --no-backup'
203 203 [1]
204 204
205 test qpop --check
206
207 $ hg qpush
208 applying p1
209 now at: p1
210 $ hg qpop --check --force
211 abort: cannot use both --force and --check
212 [255]
213 $ echo a >> a
214 $ hg qpop --check
215 abort: local changes found, refresh first
216 [255]
217 $ hg revert -qa a
218 $ rm a
219 $ hg qpop --check
220 abort: local changes found, refresh first
221 [255]
222 $ hg rm -A a
223 $ hg qpop --check
224 abort: local changes found, refresh first
225 [255]
226 $ hg revert -qa a
227 $ echo b > b
228 $ hg add b
229 $ hg qpop --check
230 abort: local changes found, refresh first
231 [255]
232 $ hg forget b
233 $ echo d > d
234 $ hg add d
235 $ hg qpop --check
236 popping p1
237 patch queue now empty
238 $ hg forget d
239 $ rm d
240
205 241 test qpush --force and backup files
206 242
207 243 $ echo a >> a
General Comments 0
You need to be logged in to leave comments. Login now