Add config option to disable putting .hg_archival.txt inside archives.
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 28 Feb 2008 22:39:59 +0100
changeset 6183 0750e4ba9d3d
parent 6182 07f2236c4dee
child 6184 9d13e7129423
Add config option to disable putting .hg_archival.txt inside archives.
doc/hgrc.5.txt
mercurial/archival.py
tests/test-archive
tests/test-archive.out
--- a/doc/hgrc.5.txt	Thu Feb 28 19:08:04 2008 +0100
+++ b/doc/hgrc.5.txt	Thu Feb 28 22:39:59 2008 +0100
@@ -513,6 +513,11 @@
 
 ui::
   User interface controls.
+  archivemeta;;
+    Whether to include the .hg_archival.txt file containing metadata
+    (hashes for the repository base and for tip) in archives created by
+    the hg archive command or downloaded via hgweb.
+    Default is true.
   debug;;
     Print debugging information.  True or False.  Default is False.
   editor;;
--- a/mercurial/archival.py	Thu Feb 28 19:08:04 2008 +0100
+++ b/mercurial/archival.py	Thu Feb 28 22:39:59 2008 +0100
@@ -214,8 +214,10 @@
     m = ctx.manifest()
     items = m.items()
     items.sort()
-    write('.hg_archival.txt', 0644, False,
-          lambda: 'repo: %s\nnode: %s\n' % (hex(repo.changelog.node(0)), hex(node)))
+    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)))
     for filename, filenode in items:
         write(filename, m.execf(filename) and 0755 or 0644, m.linkf(filename),
               lambda: repo.file(filename).read(filenode))
--- a/tests/test-archive	Thu Feb 28 19:08:04 2008 +0100
+++ b/tests/test-archive	Thu Feb 28 22:39:59 2008 +0100
@@ -59,7 +59,7 @@
 hg archive -t zip -p /illegal test.zip
 hg archive -t zip -p very/../bad test.zip
 
-hg archive -t zip -r 2 test.zip
+hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
 unzip -t test.zip
 
 hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"
--- a/tests/test-archive.out	Thu Feb 28 19:08:04 2008 +0100
+++ b/tests/test-archive.out	Thu Feb 28 22:39:59 2008 +0100
@@ -29,7 +29,6 @@
 True
 abort: archive prefix contains illegal components
 Archive:  test.zip
-    testing: test/.hg_archival.txt    OK
     testing: test/bar                 OK
     testing: test/baz/bletch          OK
     testing: test/foo                 OK