16 import match as matchmod |
16 import match as matchmod |
17 import merge as mergemod |
17 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 |
24 command = cmdutil.command(table) |
25 command = cmdutil.command(table) |
25 |
26 |
4211 for name, path in ui.configitems("paths"): |
4212 for name, path in ui.configitems("paths"): |
4212 if ui.quiet: |
4213 if ui.quiet: |
4213 ui.write("%s\n" % name) |
4214 ui.write("%s\n" % name) |
4214 else: |
4215 else: |
4215 ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
4216 ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
|
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() |
4216 |
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 |
4220 if optupdate: |
4273 if optupdate: |