##// END OF EJS Templates
mq/qqueue: add --purge option to delete a queue and its patch dir...
"Yann E. MORIN" -
r11967:6e3875a8 default
parent child Browse files
Show More
@@ -47,7 +47,7 b' from mercurial.node import bin, hex, sho'
47 47 from mercurial.lock import release
48 48 from mercurial import commands, cmdutil, hg, patch, util
49 49 from mercurial import repair, extensions, url, error
50 import os, sys, re, errno
50 import os, sys, re, errno, shutil
51 51
52 52 commands.norepo += " qclone"
53 53
@@ -2762,6 +2762,12 b' def qqueue(ui, repo, name=None, **opts):'
2762 2762 _setactivenocheck(name)
2763 2763 elif opts.get('delete'):
2764 2764 _delete(name)
2765 elif opts.get('purge'):
2766 if name in existing:
2767 _delete(name)
2768 qdir = _queuedir(name)
2769 if os.path.exists(qdir):
2770 shutil.rmtree(qdir)
2765 2771 else:
2766 2772 if name not in existing:
2767 2773 raise util.Abort(_('use --create to create a new queue'))
@@ -3089,6 +3095,7 b' cmdtable = {'
3089 3095 ('c', 'create', False, _('create new queue')),
3090 3096 ('', 'rename', False, _('rename active queue')),
3091 3097 ('', 'delete', False, _('delete reference to queue')),
3098 ('', 'purge', False, _('delete queue, and remove patch dir')),
3092 3099 ],
3093 3100 _('[OPTION] [QUEUE]')),
3094 3101 }
@@ -54,6 +54,21 b' hg qqueue foo'
54 54 hg qqueue --delete buz
55 55 hg qqueue
56 56
57 echo %% create queue for purge
58 hg qqueue --create purge-me
59 hg qqueue
60
61 echo %% create patch for purge
62 hg qnew patch-purge-me
63 ls -1d .hg/patches-purge-me 2>/dev/null || true
64 hg qpop -a
65
66 echo %% purge queue
67 hg qqueue foo
68 hg qqueue --purge purge-me
69 hg qqueue
70 ls -1d .hg/patches-purge-me 2>/dev/null || true
71
57 72 echo %% unapplied patches
58 73 hg qun
59 74 echo c > a
@@ -34,6 +34,17 b' patches'
34 34 %% switch back to previous queue
35 35 foo (active)
36 36 patches
37 %% create queue for purge
38 foo
39 patches
40 purge-me (active)
41 %% create patch for purge
42 .hg/patches-purge-me
43 popping patch-purge-me
44 patch queue now empty
45 %% purge queue
46 foo (active)
47 patches
37 48 %% unapplied patches
38 49 %% fail switching back
39 50 abort: patches applied - cannot set new queue active
General Comments 0
You need to be logged in to leave comments. Login now