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

Gilles Moris gilles.moris at free.fr
Fri Aug 7 03:00:08 CDT 2009


 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)
+            return content
+
+        write('.hg_archival.txt', 0644, False, metadata)
+
     for f in ctx:
         ff = ctx.flags(f)
         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)


More information about the Mercurial-devel mailing list