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.
--- a/hgext/lfs/__init__.py Sun Jan 14 15:39:10 2018 -0500
+++ b/hgext/lfs/__init__.py Sun Jan 14 15:56:22 2018 -0500
@@ -230,6 +230,7 @@
makemap = lambda v: {
'file': v,
+ 'oid': pointers[v].oid(),
}
# TODO: make the separator ', '?
--- a/tests/test-lfs.t Sun Jan 14 15:39:10 2018 -0500
+++ b/tests/test-lfs.t Sun Jan 14 15:56:22 2018 -0500
@@ -859,10 +859,11 @@
oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
size 29
x-is-binary 0
- $ hg --cwd convert_lfs log -r 'all()' -T '{rev}: {lfs_files % "{file}\n"}'
- 0: a1
- 1: a2
- 2: a2
+ $ hg --cwd convert_lfs \
+ > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {oid}\n"}'
+ 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+ 1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+ 2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
$ grep 'lfs' convert_lfs/.hg/requires
lfs