##// END OF EJS Templates
phases: add a phases command to display and manipulate phases
Pierre-Yves David -
r15830:8ed112ed default
parent child Browse files
Show More
@@ -18,6 +18,7 b' import merge as mergemod'
18 import minirst, revset, fileset
18 import minirst, revset, fileset
19 import dagparser, context, simplemerge
19 import dagparser, context, simplemerge
20 import random, setdiscovery, treediscovery, dagutil
20 import random, setdiscovery, treediscovery, dagutil
21 import phases as phasesmod
21
22
22 table = {}
23 table = {}
23
24
@@ -4214,6 +4215,58 b' def paths(ui, repo, search=None):'
4214 else:
4215 else:
4215 ui.write("%s = %s\n" % (name, util.hidepassword(path)))
4216 ui.write("%s = %s\n" % (name, util.hidepassword(path)))
4216
4217
4218 @command('^phase',
4219 [('p', 'public', False, _('Set changeset to public')),
4220 ('d', 'draft', False, _('Set changeset to draft')),
4221 ('s', 'secret', False, _('Set changeset to secret')),
4222 ('f', 'force', False, _('allow to move boundary backward')),
4223 ('r', 'rev', [], _('target revision')),
4224 ],
4225 _('[-p|-d|-s] [-f] [-C] [-r] REV'))
4226 def phase(ui, repo, *revs, **opts):
4227 """set or show the current phase name
4228
4229 With no argument, show the phase name of specified revisions.
4230
4231 With on one of `--public`, `--draft` or `--secret`, change the phase value.
4232
4233 Unless -f/--force is specified, :hg:`phase` won't move changeset from a
4234 lower phase to an higher phase. Phase are ordered as follow:
4235
4236 public < draft < secret.
4237 """
4238 # search for a unique phase argument
4239 targetphase = None
4240 for idx, name in enumerate(phasesmod.phasenames):
4241 if opts[name]:
4242 if targetphase is not None:
4243 raise util.Abort('only one phase can be specified')
4244 targetphase = idx
4245
4246 # look for specified revision
4247 revs = list(revs)
4248 revs.extend(opts['rev'])
4249 if not revs:
4250 raise NotImplementedError('working directory phase not implemented '
4251 'yet')
4252 lock = None
4253 if targetphase is None:
4254 # display
4255 for ctx in repo.set('%lr', revs):
4256 ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr()))
4257 else:
4258 lock = repo.lock()
4259 try:
4260 # set phase
4261 nodes = [ctx.node() for ctx in repo.set('%lr', revs)]
4262 if not nodes:
4263 raise util.Abort(_('empty revision set'))
4264 phasesmod.advanceboundary(repo, targetphase, nodes)
4265 if opts['force']:
4266 phasesmod.retractboundary(repo, targetphase, nodes)
4267 finally:
4268 lock.release()
4269
4217 def postincoming(ui, repo, modheads, optupdate, checkout):
4270 def postincoming(ui, repo, modheads, optupdate, checkout):
4218 if modheads == 0:
4271 if modheads == 0:
4219 return
4272 return
@@ -334,6 +334,7 b' invalid global arguments for normal comm'
334 init create a new repository in the given directory
334 init create a new repository in the given directory
335 log show revision history of entire repository or files
335 log show revision history of entire repository or files
336 merge merge working directory with another revision
336 merge merge working directory with another revision
337 phase set or show the current phase name
337 pull pull changes from the specified source
338 pull pull changes from the specified source
338 push push changes to the specified destination
339 push push changes to the specified destination
339 remove remove the specified files on the next commit
340 remove remove the specified files on the next commit
@@ -360,6 +361,7 b' invalid global arguments for normal comm'
360 init create a new repository in the given directory
361 init create a new repository in the given directory
361 log show revision history of entire repository or files
362 log show revision history of entire repository or files
362 merge merge working directory with another revision
363 merge merge working directory with another revision
364 phase set or show the current phase name
363 pull pull changes from the specified source
365 pull pull changes from the specified source
364 push push changes to the specified destination
366 push push changes to the specified destination
365 remove remove the specified files on the next commit
367 remove remove the specified files on the next commit
@@ -386,6 +388,7 b' invalid global arguments for normal comm'
386 init create a new repository in the given directory
388 init create a new repository in the given directory
387 log show revision history of entire repository or files
389 log show revision history of entire repository or files
388 merge merge working directory with another revision
390 merge merge working directory with another revision
391 phase set or show the current phase name
389 pull pull changes from the specified source
392 pull pull changes from the specified source
390 push push changes to the specified destination
393 push push changes to the specified destination
391 remove remove the specified files on the next commit
394 remove remove the specified files on the next commit
@@ -26,6 +26,7 b' basic commands:'
26 init create a new repository in the given directory
26 init create a new repository in the given directory
27 log show revision history of entire repository or files
27 log show revision history of entire repository or files
28 merge merge working directory with another revision
28 merge merge working directory with another revision
29 phase set or show the current phase name
29 pull pull changes from the specified source
30 pull pull changes from the specified source
30 push push changes to the specified destination
31 push push changes to the specified destination
31 remove remove the specified files on the next commit
32 remove remove the specified files on the next commit
@@ -32,6 +32,7 b' Show all commands except debug commands'
32 outgoing
32 outgoing
33 parents
33 parents
34 paths
34 paths
35 phase
35 pull
36 pull
36 push
37 push
37 recover
38 recover
@@ -198,6 +199,7 b' Show all commands + options'
198 init: ssh, remotecmd, insecure
199 init: ssh, remotecmd, insecure
199 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude
200 log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, hidden, patch, git, limit, no-merges, stat, style, template, include, exclude
200 merge: force, rev, preview, tool
201 merge: force, rev, preview, tool
202 phase: public, draft, secret, force, rev
201 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
203 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
202 push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
204 push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
203 remove: after, force, include, exclude
205 remove: after, force, include, exclude
@@ -311,6 +311,7 b' Testing -h/--help:'
311 outgoing show changesets not found in the destination
311 outgoing show changesets not found in the destination
312 parents show the parents of the working directory or revision
312 parents show the parents of the working directory or revision
313 paths show aliases for remote repositories
313 paths show aliases for remote repositories
314 phase set or show the current phase name
314 pull pull changes from the specified source
315 pull pull changes from the specified source
315 push push changes to the specified destination
316 push push changes to the specified destination
316 recover roll back an interrupted transaction
317 recover roll back an interrupted transaction
@@ -393,6 +394,7 b' Testing -h/--help:'
393 outgoing show changesets not found in the destination
394 outgoing show changesets not found in the destination
394 parents show the parents of the working directory or revision
395 parents show the parents of the working directory or revision
395 paths show aliases for remote repositories
396 paths show aliases for remote repositories
397 phase set or show the current phase name
396 pull pull changes from the specified source
398 pull pull changes from the specified source
397 push push changes to the specified destination
399 push push changes to the specified destination
398 recover roll back an interrupted transaction
400 recover roll back an interrupted transaction
@@ -15,6 +15,7 b' Short help:'
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge working directory with another revision
17 merge merge working directory with another revision
18 phase set or show the current phase name
18 pull pull changes from the specified source
19 pull pull changes from the specified source
19 push push changes to the specified destination
20 push push changes to the specified destination
20 remove remove the specified files on the next commit
21 remove remove the specified files on the next commit
@@ -36,6 +37,7 b' Short help:'
36 init create a new repository in the given directory
37 init create a new repository in the given directory
37 log show revision history of entire repository or files
38 log show revision history of entire repository or files
38 merge merge working directory with another revision
39 merge merge working directory with another revision
40 phase set or show the current phase name
39 pull pull changes from the specified source
41 pull pull changes from the specified source
40 push push changes to the specified destination
42 push push changes to the specified destination
41 remove remove the specified files on the next commit
43 remove remove the specified files on the next commit
@@ -81,6 +83,7 b' Short help:'
81 outgoing show changesets not found in the destination
83 outgoing show changesets not found in the destination
82 parents show the parents of the working directory or revision
84 parents show the parents of the working directory or revision
83 paths show aliases for remote repositories
85 paths show aliases for remote repositories
86 phase set or show the current phase name
84 pull pull changes from the specified source
87 pull pull changes from the specified source
85 push push changes to the specified destination
88 push push changes to the specified destination
86 recover roll back an interrupted transaction
89 recover roll back an interrupted transaction
@@ -157,6 +160,7 b' Short help:'
157 outgoing show changesets not found in the destination
160 outgoing show changesets not found in the destination
158 parents show the parents of the working directory or revision
161 parents show the parents of the working directory or revision
159 paths show aliases for remote repositories
162 paths show aliases for remote repositories
163 phase set or show the current phase name
160 pull pull changes from the specified source
164 pull pull changes from the specified source
161 push push changes to the specified destination
165 push push changes to the specified destination
162 recover roll back an interrupted transaction
166 recover roll back an interrupted transaction
@@ -225,6 +229,8 b' Test short command list with verbose opt'
225 show revision history of entire repository or files
229 show revision history of entire repository or files
226 merge:
230 merge:
227 merge working directory with another revision
231 merge working directory with another revision
232 phase:
233 set or show the current phase name
228 pull:
234 pull:
229 pull changes from the specified source
235 pull changes from the specified source
230 push:
236 push:
@@ -541,6 +547,7 b' Test command without options'
541 init create a new repository in the given directory
547 init create a new repository in the given directory
542 log show revision history of entire repository or files
548 log show revision history of entire repository or files
543 merge merge working directory with another revision
549 merge merge working directory with another revision
550 phase set or show the current phase name
544 pull pull changes from the specified source
551 pull pull changes from the specified source
545 push push changes to the specified destination
552 push push changes to the specified destination
546 remove remove the specified files on the next commit
553 remove remove the specified files on the next commit
@@ -568,6 +575,7 b' Test command without options'
568 init create a new repository in the given directory
575 init create a new repository in the given directory
569 log show revision history of entire repository or files
576 log show revision history of entire repository or files
570 merge merge working directory with another revision
577 merge merge working directory with another revision
578 phase set or show the current phase name
571 pull pull changes from the specified source
579 pull pull changes from the specified source
572 push push changes to the specified destination
580 push push changes to the specified destination
573 remove remove the specified files on the next commit
581 remove remove the specified files on the next commit
@@ -643,6 +651,7 b' Test that default list of commands omits'
643 outgoing show changesets not found in the destination
651 outgoing show changesets not found in the destination
644 parents show the parents of the working directory or revision
652 parents show the parents of the working directory or revision
645 paths show aliases for remote repositories
653 paths show aliases for remote repositories
654 phase set or show the current phase name
646 pull pull changes from the specified source
655 pull pull changes from the specified source
647 push push changes to the specified destination
656 push push changes to the specified destination
648 recover roll back an interrupted transaction
657 recover roll back an interrupted transaction
@@ -26,7 +26,7 b' Following commit are draft too'
26
26
27 Draft commit are properly created over public one:
27 Draft commit are properly created over public one:
28
28
29 $ hg pull -q . # XXX use the dedicated phase command once available
29 $ hg phase --public .
30 $ hglog
30 $ hglog
31 1 0 B
31 1 0 B
32 0 0 A
32 0 0 A
@@ -154,3 +154,109 b' Test revset'
154 4 2 E
154 4 2 E
155 5 2 H
155 5 2 H
156 7 2 merge B' and E
156 7 2 merge B' and E
157
158 Test phase command
159 ===================
160
161 initial picture
162
163 $ cat >> $HGRCPATH << EOF
164 > [extensions]
165 > hgext.graphlog=
166 > EOF
167 $ hg log -G --template "{rev} {phase} {desc}\n"
168 @ 7 secret merge B' and E
169 |\
170 | o 6 draft B'
171 | |
172 +---o 5 secret H
173 | |
174 o | 4 secret E
175 | |
176 o | 3 draft D
177 | |
178 o | 2 draft C
179 |/
180 o 1 public B
181 |
182 o 0 public A
183
184
185 display changesets phase
186
187 (mixing -r and plain rev specification)
188
189 $ hg phase 1::4 -r 7
190 1: public
191 2: draft
192 3: draft
193 4: secret
194 7: secret
195
196
197 move changeset forward
198
199 (with -r option)
200
201 $ hg phase --public -r 2
202 $ hg log -G --template "{rev} {phase} {desc}\n"
203 @ 7 secret merge B' and E
204 |\
205 | o 6 draft B'
206 | |
207 +---o 5 secret H
208 | |
209 o | 4 secret E
210 | |
211 o | 3 draft D
212 | |
213 o | 2 public C
214 |/
215 o 1 public B
216 |
217 o 0 public A
218
219
220 move changeset backward
221
222 (without -r option)
223
224 $ hg phase --draft --force 2
225 $ hg log -G --template "{rev} {phase} {desc}\n"
226 @ 7 secret merge B' and E
227 |\
228 | o 6 draft B'
229 | |
230 +---o 5 secret H
231 | |
232 o | 4 secret E
233 | |
234 o | 3 draft D
235 | |
236 o | 2 draft C
237 |/
238 o 1 public B
239 |
240 o 0 public A
241
242
243 move changeset forward and backward
244
245 $ hg phase --draft --force 1::4
246 $ hg log -G --template "{rev} {phase} {desc}\n"
247 @ 7 secret merge B' and E
248 |\
249 | o 6 draft B'
250 | |
251 +---o 5 secret H
252 | |
253 o | 4 draft E
254 | |
255 o | 3 draft D
256 | |
257 o | 2 draft C
258 |/
259 o 1 draft B
260 |
261 o 0 public A
262
@@ -26,6 +26,7 b''
26 init create a new repository in the given directory
26 init create a new repository in the given directory
27 log show revision history of entire repository or files
27 log show revision history of entire repository or files
28 merge merge working directory with another revision
28 merge merge working directory with another revision
29 phase set or show the current phase name
29 pull pull changes from the specified source
30 pull pull changes from the specified source
30 push push changes to the specified destination
31 push push changes to the specified destination
31 remove remove the specified files on the next commit
32 remove remove the specified files on the next commit
General Comments 0
You need to be logged in to leave comments. Login now