##// END OF EJS Templates
mq: prevent the creation of a queue whose name is already taken...
Cédric Duval -
r11271:d1aca086 default
parent child Browse files
Show More
@@ -2633,17 +2633,17 b' def qqueue(ui, repo, name=None, **opts):'
2633
2633
2634 existing = _getqueues()
2634 existing = _getqueues()
2635
2635
2636 if name not in existing and opts.get('delete'):
2637 raise util.Abort(_('cannot delete queue that does not exist'))
2638 elif name not in existing and not opts.get('create'):
2639 raise util.Abort(_('use --create to create a new queue'))
2640
2641 if opts.get('create'):
2636 if opts.get('create'):
2637 if name in existing:
2638 raise util.Abort(_('queue "%s" already exists') % name)
2642 if _noqueues():
2639 if _noqueues():
2643 _addqueue(_defaultqueue)
2640 _addqueue(_defaultqueue)
2644 _addqueue(name)
2641 _addqueue(name)
2645 _setactive(name)
2642 _setactive(name)
2646 elif opts.get('delete'):
2643 elif opts.get('delete'):
2644 if name not in existing:
2645 raise util.Abort(_('cannot delete queue that does not exist'))
2646
2647 current = _getcurrent()
2647 current = _getcurrent()
2648
2648
2649 if name == current:
2649 if name == current:
@@ -2657,6 +2657,8 b' def qqueue(ui, repo, name=None, **opts):'
2657 fh.close()
2657 fh.close()
2658 util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
2658 util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
2659 else:
2659 else:
2660 if name not in existing:
2661 raise util.Abort(_('use --create to create a new queue'))
2660 _setactive(name)
2662 _setactive(name)
2661
2663
2662 def reposetup(ui, repo):
2664 def reposetup(ui, repo):
@@ -28,6 +28,10 b' echo %% switch queue'
28 hg qqueue foo
28 hg qqueue foo
29 hg qqueue
29 hg qqueue
30
30
31 echo %% fail creating queue with already existing name
32 hg qqueue --create foo
33 hg qqueue
34
31 echo %% unapplied patches
35 echo %% unapplied patches
32 hg qun
36 hg qun
33 echo c > a
37 echo c > a
@@ -12,6 +12,10 b' patch queue now empty'
12 %% switch queue
12 %% switch queue
13 foo (active)
13 foo (active)
14 patches
14 patches
15 %% fail creating queue with already existing name
16 abort: queue "foo" already exists
17 foo (active)
18 patches
15 %% unapplied patches
19 %% unapplied patches
16 %% fail switching back
20 %% fail switching back
17 abort: patches applied - cannot set new queue active
21 abort: patches applied - cannot set new queue active
General Comments 0
You need to be logged in to leave comments. Login now