[PATCH 1 of 2] archive: add tags to the .hg_archival.txt file

Greg Ward greg-hg at gerg.ca
Fri Aug 7 12:08:29 CDT 2009


On Fri, Aug 7, 2009 at 4:00 AM, Gilles Moris<gilles.moris at free.fr> wrote:
>  mercurial/archival.py |  13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
>
>
> # HG changeset patch
> # User Gilles Moris <gilles.moris at free.fr>
> # Date 1249631889 -7200
> # Node ID df6273f8f6268cba0124761e5b659eb06e5a6dcf
> # Parent  25593f80177fb6d5c9b07ee35415efd94abf690c
> archive: add tags to the .hg_archival.txt file
>
> diff --git a/mercurial/archival.py b/mercurial/archival.py
> --- a/mercurial/archival.py
> +++ b/mercurial/archival.py
> @@ -217,9 +217,16 @@
>     archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0])
>
>     if repo.ui.configbool("ui", "archivemeta", True):
> -        write('.hg_archival.txt', 0644, False,
> -              lambda: 'repo: %s\nnode: %s\n' % (
> -                  hex(repo.changelog.node(0)), hex(node)))
> +        def metadata():
> +            content = 'repo: %s\nnode: %s\n' % (
> +                hex(repo.changelog.node(0)), hex(node))
> +            tags = [t for t in ctx.tags() if repo.tagtype(t) == 'global']
> +            if tags:
> +                content += 'tags: %s\n' % ' '.join(tags)

That won't work: tag names can have spaces.  See
localrepository._tag() in localrepo.py.  That code suggests the only
valid delimiters are colon and newline.  So why not something like
this:

  tag: foo
  tag: bar
  tag: blah

?  If nothing else, that's consistent with the default output of 'hg log'.

Greg



More information about the Mercurial-devel mailing list