[PATCH 1 of 3] lfs: add the '{pointer}' template keyword to '{lfs_files}'

Matt Harbison mharbison72 at gmail.com
Thu Jan 18 03:08:35 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1515967224 18000
#      Sun Jan 14 17:00:24 2018 -0500
# Node ID 5958f27453d90c24f443d698439c2a8cd39e70c2
# Parent  a62b08f6626bd0f838b2c77a2f1a48068852be1f
lfs: add the '{pointer}' template keyword to '{lfs_files}'

This provides access to the metadata dictionary contained within the tracked
pointer file.  The OID is probably the most important attribute, and has its own
keyword.  But we might as well have this for completeness.

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -314,6 +314,7 @@
     makemap = lambda v: {
         'file': v,
         'oid': pointers[v].oid(),
+        'pointer': pointers[v],
     }
 
     # TODO: make the separator ', '?
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -865,6 +865,8 @@
   oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   size 29
   x-is-binary 0
+  $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{pointer.oid}\n"}'
+  sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   $ hg --cwd convert_lfs \
   >     log -r 'all()' -T '{rev}: {lfs_files % "{file}: {oid}\n"}'
   0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024


More information about the Mercurial-devel mailing list