# HG changeset patch # User Pierre-Yves David # Date 1343237762 -7200 # Node ID 97b75bbfacc5736829d17426188667a826df535e # Parent 0e87a890d84bbcf2c731a4ca43d76247ccc386cb obsolete: rely on core for context and reveset which exist there (this means loosing the cache :-( ) diff -r 0e87a890d84b -r 97b75bbfacc5 hgext/obsolete.py --- a/hgext/obsolete.py Wed Jul 25 19:28:46 2012 +0200 +++ b/hgext/obsolete.py Wed Jul 25 19:36:02 2012 +0200 @@ -100,22 +100,6 @@ ### Patch changectx ############################# -def unstable(ctx): - """is the changeset unstable (have obsolete ancestor)""" - if ctx.node() is None: - return False - return ctx.rev() in ctx._repo._unstableset - -context.changectx.unstable = unstable - -def extinct(ctx): - """is the changeset extinct by other""" - if ctx.node() is None: - return False - return ctx.rev() in ctx._repo._extinctset - -context.changectx.extinct = extinct - def latecomer(ctx): """is the changeset latecomer (Try to succeed to public change)""" if ctx.node() is None: @@ -141,33 +125,11 @@ args = revset.getargs(x, 0, 0, 'hidden takes no argument') return [r for r in subset if r in repo.changelog.hiddenrevs] -def revsetobsolete(repo, subset, x): - """obsolete changesets""" - args = revset.getargs(x, 0, 0, 'obsolete takes no argument') - return [r for r in subset if r in repo._obsoleteset and repo._phasecache.phase(repo, r) > 0] - -# XXX Backward compatibility, to be removed once stabilized -if '_phasecache' not in vars(localrepo.localrepository): # new api - def revsetobsolete(repo, subset, x): - """obsolete changesets""" - args = revset.getargs(x, 0, 0, 'obsolete takes no argument') - return [r for r in subset if r in repo._obsoleteset and repo._phaserev[r] > 0] - -def revsetunstable(repo, subset, x): - """non obsolete changesets descendant of obsolete one""" - args = revset.getargs(x, 0, 0, 'unstable takes no arguments') - return [r for r in subset if r in repo._unstableset] - def revsetsuspended(repo, subset, x): """obsolete changesets with non obsolete descendants""" args = revset.getargs(x, 0, 0, 'suspended takes no arguments') return [r for r in subset if r in repo._suspendedset] -def revsetextinct(repo, subset, x): - """obsolete changesets without obsolete descendants""" - args = revset.getargs(x, 0, 0, 'extinct takes no arguments') - return [r for r in subset if r in repo._extinctset] - def revsetlatecomer(repo, subset, x): """latecomer, Try to succeed to public change""" args = revset.getargs(x, 0, 0, 'latecomer takes no arguments') @@ -371,10 +333,7 @@ def extsetup(ui): revset.symbols["hidden"] = revsethidden - revset.symbols["obsolete"] = revsetobsolete - revset.symbols["unstable"] = revsetunstable revset.symbols["suspended"] = revsetsuspended - revset.symbols["extinct"] = revsetextinct revset.symbols["latecomer"] = revsetlatecomer revset.symbols["conflicting"] = revsetconflicting revset.symbols["obsparents"] = revsetprecursors # DEPR @@ -388,11 +347,11 @@ # warning about more obsolete for cmd in ['commit', 'push', 'pull', 'graft', 'phase', 'unbundle']: - entry = extensions.wrapcommand(commands.table, cmd, warnobserrors) + extensions.wrapcommand(commands.table, cmd, warnobserrors) try: rebase = extensions.find('rebase') if rebase: - entry = extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) + extensions.wrapcommand(rebase.cmdtable, 'rebase', warnobserrors) extensions.wrapfunction(rebase, 'buildstate', buildstate) extensions.wrapfunction(rebase, 'defineparents', defineparents) extensions.wrapfunction(rebase, 'concludenode', concludenode) @@ -414,7 +373,7 @@ for h in outgoing.missingheads: # checking heads only is enought because any thing base on obsolete # changeset is either obsolete or unstable. - ctx = repo[h] + ctx = repo[h] if ctx.latecomer(): raise util.Abort(_("push includes an latecomer changeset: %s!") % ctx)