hgext/states.py
changeset 63 f47a5f990eb2
parent 62 bd33e749dfcc
child 64 6a7dc5ca05b8
equal deleted inserted replaced
62:bd33e749dfcc 63:f47a5f990eb2
   244       _``<state>heads()``
   244       _``<state>heads()``
   245 
   245 
   246     - add ``<state>heads()`` directives to that return the currently in used heads
   246     - add ``<state>heads()`` directives to that return the currently in used heads
   247 
   247 
   248     - add ``<state>()`` directives that match all node in a state.
   248     - add ``<state>()`` directives that match all node in a state.
       
   249 
       
   250 Other extensions
       
   251 ................
       
   252 
       
   253 :Rebase:     can't rewrite unpublished changeset.
       
   254 
       
   255 
   249 
   256 
   250 Implementation
   257 Implementation
   251 ==============
   258 ==============
   252 
   259 
   253 State definition
   260 State definition
   632     This is a write protocol command"""
   639     This is a write protocol command"""
   633     st = laststatewithout(_NOSHARE)
   640     st = laststatewithout(_NOSHARE)
   634     h = repo.stateheads(st)
   641     h = repo.stateheads(st)
   635     return wireproto.encodelist(h) + "\n"
   642     return wireproto.encodelist(h) + "\n"
   636 
   643 
       
   644 # Other extension support
       
   645 #########################
       
   646 
       
   647 def wraprebasebuildstate(orig, repo, *args, **kwargs):
       
   648    result = orig(repo, *args, **kwargs)
       
   649    if result is not None:
       
   650         revs = result[2]
       
   651         base = repo.changelog.node(min(result[2]))
       
   652         state = repo.nodestate(base)
       
   653         if not state.properties & _MUTABLE:
       
   654             raise util.Abort(_('can not rebase published changeset %s')
       
   655                              % node.short(base),
       
   656                              hint=_('see `hg help --extension states` for details'))
       
   657    return result
       
   658 
       
   659 
   637 def uisetup(ui):
   660 def uisetup(ui):
   638     """
   661     """
   639     * patch stuff for the _NOSHARE property
   662     * patch stuff for the _NOSHARE property
   640     * add template keyword
   663     * add template keyword
   641     """
   664     """
   654 
   677 
   655     * add revset entry"""
   678     * add revset entry"""
   656     for state in STATES:
   679     for state in STATES:
   657         if state.trackheads:
   680         if state.trackheads:
   658             revset.symbols[state.headssymbol] = state._revsetheads
   681             revset.symbols[state.headssymbol] = state._revsetheads
       
   682     try:
       
   683         rebase = extensions.find('rebase')
       
   684         if rebase:
       
   685             extensions.wrapfunction(rebase, 'buildstate', wraprebasebuildstate)
       
   686     except KeyError:
       
   687         pass # rebase not found
   659 
   688 
   660 
   689 
   661 
   690 
   662 def reposetup(ui, repo):
   691 def reposetup(ui, repo):
   663     """Repository setup
   692     """Repository setup