##// 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 18 import minirst, revset, fileset
19 19 import dagparser, context, simplemerge
20 20 import random, setdiscovery, treediscovery, dagutil
21 import phases as phasesmod
21 22
22 23 table = {}
23 24
@@ -4214,6 +4215,58 b' def paths(ui, repo, search=None):'
4214 4215 else:
4215 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 4270 def postincoming(ui, repo, modheads, optupdate, checkout):
4218 4271 if modheads == 0:
4219 4272 return
@@ -334,6 +334,7 b' invalid global arguments for normal comm'
334 334 init create a new repository in the given directory
335 335 log show revision history of entire repository or files
336 336 merge merge working directory with another revision
337 phase set or show the current phase name
337 338 pull pull changes from the specified source
338 339 push push changes to the specified destination
339 340 remove remove the specified files on the next commit
@@ -360,6 +361,7 b' invalid global arguments for normal comm'
360 361 init create a new repository in the given directory
361 362 log show revision history of entire repository or files
362 363 merge merge working directory with another revision
364 phase set or show the current phase name
363 365 pull pull changes from the specified source
364 366 push push changes to the specified destination
365 367 remove remove the specified files on the next commit
@@ -386,6 +388,7 b' invalid global arguments for normal comm'
386 388 init create a new repository in the given directory
387 389 log show revision history of entire repository or files
388 390 merge merge working directory with another revision
391 phase set or show the current phase name
389 392 pull pull changes from the specified source
390 393 push push changes to the specified destination
391 394 remove remove the specified files on the next commit
@@ -26,6 +26,7 b' basic commands:'
26 26 init create a new repository in the given directory
27 27 log show revision history of entire repository or files
28 28 merge merge working directory with another revision
29 phase set or show the current phase name
29 30 pull pull changes from the specified source
30 31 push push changes to the specified destination
31 32 remove remove the specified files on the next commit
@@ -32,6 +32,7 b' Show all commands except debug commands'
32 32 outgoing
33 33 parents
34 34 paths
35 phase
35 36 pull
36 37 push
37 38 recover
@@ -198,6 +199,7 b' Show all commands + options'
198 199 init: ssh, remotecmd, insecure
199 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 201 merge: force, rev, preview, tool
202 phase: public, draft, secret, force, rev
201 203 pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
202 204 push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
203 205 remove: after, force, include, exclude
@@ -311,6 +311,7 b' Testing -h/--help:'
311 311 outgoing show changesets not found in the destination
312 312 parents show the parents of the working directory or revision
313 313 paths show aliases for remote repositories
314 phase set or show the current phase name
314 315 pull pull changes from the specified source
315 316 push push changes to the specified destination
316 317 recover roll back an interrupted transaction
@@ -393,6 +394,7 b' Testing -h/--help:'
393 394 outgoing show changesets not found in the destination
394 395 parents show the parents of the working directory or revision
395 396 paths show aliases for remote repositories
397 phase set or show the current phase name
396 398 pull pull changes from the specified source
397 399 push push changes to the specified destination
398 400 recover roll back an interrupted transaction
@@ -15,6 +15,7 b' Short help:'
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge working directory with another revision
18 phase set or show the current phase name
18 19 pull pull changes from the specified source
19 20 push push changes to the specified destination
20 21 remove remove the specified files on the next commit
@@ -36,6 +37,7 b' Short help:'
36 37 init create a new repository in the given directory
37 38 log show revision history of entire repository or files
38 39 merge merge working directory with another revision
40 phase set or show the current phase name
39 41 pull pull changes from the specified source
40 42 push push changes to the specified destination
41 43 remove remove the specified files on the next commit
@@ -81,6 +83,7 b' Short help:'
81 83 outgoing show changesets not found in the destination
82 84 parents show the parents of the working directory or revision
83 85 paths show aliases for remote repositories
86 phase set or show the current phase name
84 87 pull pull changes from the specified source
85 88 push push changes to the specified destination
86 89 recover roll back an interrupted transaction
@@ -157,6 +160,7 b' Short help:'
157 160 outgoing show changesets not found in the destination
158 161 parents show the parents of the working directory or revision
159 162 paths show aliases for remote repositories
163 phase set or show the current phase name
160 164 pull pull changes from the specified source
161 165 push push changes to the specified destination
162 166 recover roll back an interrupted transaction
@@ -225,6 +229,8 b' Test short command list with verbose opt'
225 229 show revision history of entire repository or files
226 230 merge:
227 231 merge working directory with another revision
232 phase:
233 set or show the current phase name
228 234 pull:
229 235 pull changes from the specified source
230 236 push:
@@ -541,6 +547,7 b' Test command without options'
541 547 init create a new repository in the given directory
542 548 log show revision history of entire repository or files
543 549 merge merge working directory with another revision
550 phase set or show the current phase name
544 551 pull pull changes from the specified source
545 552 push push changes to the specified destination
546 553 remove remove the specified files on the next commit
@@ -568,6 +575,7 b' Test command without options'
568 575 init create a new repository in the given directory
569 576 log show revision history of entire repository or files
570 577 merge merge working directory with another revision
578 phase set or show the current phase name
571 579 pull pull changes from the specified source
572 580 push push changes to the specified destination
573 581 remove remove the specified files on the next commit
@@ -643,6 +651,7 b' Test that default list of commands omits'
643 651 outgoing show changesets not found in the destination
644 652 parents show the parents of the working directory or revision
645 653 paths show aliases for remote repositories
654 phase set or show the current phase name
646 655 pull pull changes from the specified source
647 656 push push changes to the specified destination
648 657 recover roll back an interrupted transaction
@@ -26,7 +26,7 b' Following commit are draft too'
26 26
27 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 30 $ hglog
31 31 1 0 B
32 32 0 0 A
@@ -154,3 +154,109 b' Test revset'
154 154 4 2 E
155 155 5 2 H
156 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 26 init create a new repository in the given directory
27 27 log show revision history of entire repository or files
28 28 merge merge working directory with another revision
29 phase set or show the current phase name
29 30 pull pull changes from the specified source
30 31 push push changes to the specified destination
31 32 remove remove the specified files on the next commit
General Comments 0
You need to be logged in to leave comments. Login now