obsolete.py
changeset 39 b12655157ba0
parent 38 7f7a62dac9ae
child 40 b9a5a596d9ef
equal deleted inserted replaced
38:7f7a62dac9ae 39:b12655157ba0
     6 # This software may be used and distributed according to the terms of the
     6 # This software may be used and distributed according to the terms of the
     7 # GNU General Public License version 2 or any later version.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 from mercurial import util
     9 from mercurial import util
    10 from mercurial import context
    10 from mercurial import context
       
    11 from mercurial import revset
    11 from mercurial.node import hex, bin
    12 from mercurial.node import hex, bin
    12 
    13 
    13 # Patch changectx
    14 # Patch changectx
    14 #############################
    15 #############################
    15 
    16 
    24 ohidden = context.changectx.hidden
    25 ohidden = context.changectx.hidden
    25 def hidden(ctx):
    26 def hidden(ctx):
    26     ctx._repo._obsobjrels # XXX hack to fill hiddenrevs
    27     ctx._repo._obsobjrels # XXX hack to fill hiddenrevs
    27     return ohidden(ctx)
    28     return ohidden(ctx)
    28 context.changectx.hidden = hidden
    29 context.changectx.hidden = hidden
       
    30 
       
    31 # revset
       
    32 #############################
       
    33 
       
    34 def revsetobsolete(repo, subset, x):
       
    35     args = revset.getargs(x, 0, 0, 'publicheads takes no arguments')
       
    36     return [r for r in subset if repo[r].obsolete()] # XXX slow
       
    37 
       
    38 def extsetup(ui):
       
    39     revset.symbols["obsolete"] = revsetobsolete
    29 
    40 
    30 # New commands
    41 # New commands
    31 #############################
    42 #############################
    32 
    43 
    33 
    44