[PATCH 2 of 2] archive: add an experimental config to control the metadata file template

Matt Harbison mharbison72 at gmail.com
Mon Jul 17 00:57:39 EDT 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1500266969 14400
#      Mon Jul 17 00:49:29 2017 -0400
# Node ID a85b7c754630cb4ac49b2cebea0ceca3d2f2eaaa
# Parent  4d37def90ad5e0196dadb9bc2c9e62effad63691
archive: add an experimental config to control the metadata file template

Experimental because given the possible complexity, it may be worth figuring out
how to load this from a file, similar to the style files for the log command,
instead of trying to stuff it on the command line.

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -99,7 +99,8 @@
     )
 
     opts = {
-        'template': default
+        'template': repo.ui.config('experimental', 'archivemetatemplate',
+                                   default)
     }
 
     out = util.stringio()
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -263,6 +263,12 @@
   $ hg update -Cq .
   $ rm -r ../wdir
 
+  $ hg archive -S -qr 'wdir()' ../wdir \
+  >            --config 'experimental.archivemetatemplate=archived {node|short}\n'
+  $ cat ../wdir/.hg_archival.txt
+  archived ffffffffffff
+  $ rm -r ../wdir
+
 .. but first take a detour through some deep removal testing
 
   $ hg remove -S -I 're:.*.txt' .


More information about the Mercurial-devel mailing list