##// END OF EJS Templates
mq: introduce mq.check setting...
Patrick Mezard -
r16656:4ae3ba9e default
parent child Browse files
Show More
@@ -46,6 +46,17 b' It may be desirable for mq changesets to'
46
46
47 You will by default be managing a patch queue named "patches". You can
47 You will by default be managing a patch queue named "patches". You can
48 create other, independent patch queues with the :hg:`qqueue` command.
48 create other, independent patch queues with the :hg:`qqueue` command.
49
50 If the working directory contains uncommitted files, qpush, qpop and
51 qgoto abort immediately. If -f/--force is used, the changes are
52 discarded. Setting:
53
54 [mq]
55 check = True
56
57 make them behave as if -c/--check were passed, and non-conflicting
58 local changes will be tolerated and preserved. If incompatible options
59 such as -f/--force or --exact are passed, this setting is ignored.
49 '''
60 '''
50
61
51 from mercurial.i18n import _
62 from mercurial.i18n import _
@@ -1986,6 +1997,14 b' class queue(object):'
1986 self.removeundo(repo)
1997 self.removeundo(repo)
1987 return imported
1998 return imported
1988
1999
2000 def fixcheckopts(ui, opts):
2001 if (not ui.configbool('mq', 'check') or opts.get('force')
2002 or opts.get('exact')):
2003 return opts
2004 opts = dict(opts)
2005 opts['check'] = True
2006 return opts
2007
1989 @command("qdelete|qremove|qrm",
2008 @command("qdelete|qremove|qrm",
1990 [('k', 'keep', None, _('keep patch file')),
2009 [('k', 'keep', None, _('keep patch file')),
1991 ('r', 'rev', [],
2010 ('r', 'rev', [],
@@ -2533,6 +2552,7 b' def goto(ui, repo, patch, **opts):'
2533 '''push or pop patches until named patch is at top of stack
2552 '''push or pop patches until named patch is at top of stack
2534
2553
2535 Returns 0 on success.'''
2554 Returns 0 on success.'''
2555 opts = fixcheckopts(ui, opts)
2536 q = repo.mq
2556 q = repo.mq
2537 patch = q.lookup(patch)
2557 patch = q.lookup(patch)
2538 nobackup = opts.get('no_backup')
2558 nobackup = opts.get('no_backup')
@@ -2687,6 +2707,7 b' def push(ui, repo, patch=None, **opts):'
2687 q = repo.mq
2707 q = repo.mq
2688 mergeq = None
2708 mergeq = None
2689
2709
2710 opts = fixcheckopts(ui, opts)
2690 if opts.get('merge'):
2711 if opts.get('merge'):
2691 if opts.get('name'):
2712 if opts.get('name'):
2692 newpath = repo.join(opts.get('name'))
2713 newpath = repo.join(opts.get('name'))
@@ -2725,6 +2746,7 b' def pop(ui, repo, patch=None, **opts):'
2725
2746
2726 Return 0 on success.
2747 Return 0 on success.
2727 """
2748 """
2749 opts = fixcheckopts(ui, opts)
2728 localupdate = True
2750 localupdate = True
2729 if opts.get('name'):
2751 if opts.get('name'):
2730 q = queue(ui, repo.path, repo.join(opts.get('name')))
2752 q = queue(ui, repo.path, repo.join(opts.get('name')))
@@ -387,3 +387,38 b' test qgoto --check'
387 now at: p2
387 now at: p2
388 $ hg st a
388 $ hg st a
389 M a
389 M a
390
391 test mq.check setting
392
393 $ hg --config mq.check=1 qpush
394 applying p3
395 now at: p3
396 $ hg st a
397 M a
398 $ hg --config mq.check=1 qpop
399 popping p3
400 now at: p2
401 $ hg st a
402 M a
403 $ hg --config mq.check=1 qgoto p3
404 applying p3
405 now at: p3
406 $ hg st a
407 M a
408 $ echo b >> b
409 $ hg --config mq.check=1 qpop --force
410 popping p3
411 now at: p2
412 $ hg st b
413 $ hg --config mq.check=1 qpush --exact
414 abort: local changes found, refresh first
415 [255]
416 $ hg revert -qa a
417 $ hg qpop
418 popping p2
419 patch queue now empty
420 $ echo a >> a
421 $ hg --config mq.check=1 qpush --force
422 applying p2
423 now at: p2
424 $ hg st a
@@ -59,6 +59,15 b' help'
59 You will by default be managing a patch queue named "patches". You can create
59 You will by default be managing a patch queue named "patches". You can create
60 other, independent patch queues with the "hg qqueue" command.
60 other, independent patch queues with the "hg qqueue" command.
61
61
62 If the working directory contains uncommitted files, qpush, qpop and qgoto
63 abort immediately. If -f/--force is used, the changes are discarded. Setting:
64
65 [mq] check = True
66
67 make them behave as if -c/--check were passed, and non-conflicting local
68 changes will be tolerated and preserved. If incompatible options such as
69 -f/--force or --exact are passed, this setting is ignored.
70
62 list of commands:
71 list of commands:
63
72
64 qapplied print the patches already applied
73 qapplied print the patches already applied
General Comments 0
You need to be logged in to leave comments. Login now