[PATCH 2 of 6 OBSOLETE-MARKERS] obsolete: add an `obsolete` command to create obsolete marker

Patrick Mézard patrick at mezard.eu
Sun May 13 08:24:25 CDT 2012


Le 12/05/12 19:08, Pierre-Yves David a écrit :
> # HG changeset patch
> # User Pierre-Yves.David at ens-lyon.org
> # Date 1336836697 -7200
> # Node ID 42dd37168856ca2f3459ca29b318f0278bf68205
> # Parent  b2cecf48226020c40d448617fc6d421c4e7f6cfe
> obsolete: add an `obsolete` command to create obsolete marker
> 
> For now, This function add a simple obsolete marker. No remplacement, no flag,
> no metadata.
> 
> In experimental version, this command was named "kill". I decided this was a
> terrible name after forget "hg" in front of "hg kill" and destroyed my X server
> a few times.
> 
> This command is mark as DEPRECATED because standard user do not want to run into
> it for now. Activating a specific config option may be necessary to use it in
> the future. When the whole obsolete markers business will be ready enough, this
> command will be advertised to the end user.
> 
> diff -r b2cecf482260 -r 42dd37168856 mercurial/commands.py
> --- a/mercurial/commands.py	Sat May 12 17:21:32 2012 +0200
> +++ b/mercurial/commands.py	Sat May 12 17:31:37 2012 +0200
> @@ -4170,6 +4170,28 @@
>      finally:
>          ui.setconfig('ui', 'forcemerge', '')
>  
> + at command('obsolete',
> +    [('r', 'rev', [], _('mark given revision as obsolete'), _('REV')),
> +    ],
> +    _('[--rev] REV'))
> +def obsolete(ui, repo, *revs, **opts):
> +    """mark a changeset as obsolete (DEPRECATED)"""
> +    revs = list(revs)
> +    revs.extend(opts['rev'])
> +    revs = scmutil.revrange(repo, revs)

Nitpick:

revs = scmutil.revrange(revs + opts.get('rev', []))

> +    if not revs:
> +        raise util.Abort(_('no revisions specified'))
> +
> +    l = repo.lock()
> +    try:
> +        for obs in revs:
> +            marker = (repo[obs].node(), (), 0, '')

What about an .obsolete(rev) method in obsstore to avoid leaking the marker format?

> +            repo.obsstore.add(marker)
> +    finally:
> +        l.release()
> +
> +
> +
>  @command('outgoing|out',
>      [('f', 'force', None, _('run even when the destination is unrelated')),
>      ('r', 'rev', [],

[...]

--
Patrick Mézard


More information about the Mercurial-devel mailing list