[PATCH 6 of 6 OBSOLETE-MARKERS] obsolete: command can now specify `replacing` changeset

Patrick Mézard patrick at mezard.eu
Sun May 13 08:45:57 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 1336841272 -7200
> # Node ID 0b316fb8ffc3732d3fa0fe2f81ce782e05f7dc80
> # Parent  09943a88d99a60e597ba7c3828612c7bec43e370
> obsolete: command can now specify `replacing` changeset.
> 
> A "--new" option is added to the hg obsolete command. This allow to specify
> replacement changeset when creating marker.
> 
> diff -r 09943a88d99a -r 0b316fb8ffc3 mercurial/commands.py
> --- a/mercurial/commands.py	Sat May 12 18:39:11 2012 +0200
> +++ b/mercurial/commands.py	Sat May 12 18:47:52 2012 +0200
> @@ -4173,6 +4173,7 @@
>  
>  @command('obsolete',
>      [('r', 'rev', [], _('mark given revision as obsolete'), _('REV')),
> +    ('N', 'new', [], _('Newer changeset replacing obsoleted one'), _('REV')),

Indentation, no leading capital.

Maybe --by:

  $ hg obsolete --by 123456

?

-b might not be a great short-opt.

>      ] + commitopts2,
>      _('[--rev] REV'))
>  def obsolete(ui, repo, *revs, **opts):
> @@ -4183,6 +4184,7 @@
>      if not revs:
>          raise util.Abort(_('no revisions specified'))
>  
> +    new = scmutil.revrange(repo, opts['new'])
>      metadata = {}
>      metadata['date'] = opts['date'] or '%f %i' % util.makedate()
>      try:
> @@ -4195,7 +4197,9 @@
>      l = repo.lock()
>      try:
>          for obs in revs:
> -            marker = (repo[obs].node(), (), 0, metadata)
> +            marker = (repo[obs].node(),
> +                      tuple(repo[n].node() for n in new),
> +                      0, metadata)

Again, an obsstore method.

>              repo.obsstore.add(marker)
>      finally:
>          l.release()

--
Patrick Mézard


More information about the Mercurial-devel mailing list