# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1515963382 18000
#      Sun Jan 14 15:56:22 2018 -0500
# Node ID 44ce4d93f9dce5393d0e2456ed89c7858dece71f
# Parent  47840d8f396120e9fbfe74f874abd6b34725d807
lfs: add the '{oid}' template keyword to '{lfs_files}'

The 'sha256:' prefix is skipped because this seems like the most convenient way
to consume it.  Maybe we should also add a '{oid_type}' keyword?  Then again,
that can be added in the future if a different algorithm is supported.

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -230,6 +230,7 @@
 
     makemap = lambda v: {
         'lfs_file': v,
+        'oid': pointers[v].oid(),
     }
 
     # 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
@@ -859,10 +859,11 @@
   oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   size 29
   x-is-binary 0
-  $ hg --cwd convert_lfs log -r 'all()' -T '{rev}: {lfs_files % 
"{lfs_file}\n"}'
-  0: a1
-  1: a2
-  2: a2
+  $ hg --cwd convert_lfs \
+  >     log -r 'all()' -T '{rev}: {lfs_files % "{lfs_file}: {oid}\n"}'
+  0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
 
   $ grep 'lfs' convert_lfs/.hg/requires
   lfs
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to