[PATCH] lfs: rename {lfsattrs} to {pointer}

Matt Harbison mharbison72 at gmail.com
Sat Jan 20 07:52:30 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1516407650 18000
#      Fri Jan 19 19:20:50 2018 -0500
# Node ID 9179400df335ad78c59f165cea811471905ec51a
# Parent  069df0b952e803b3efb3c59c423522a4800ecde4
lfs: rename {lfsattrs} to {pointer}

This seems more descriptive.

diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -315,7 +315,7 @@
     pointers = wrapper.pointersfromctx(ctx) # {path: pointer}
     files = sorted(pointers.keys())
 
-    def lfsattrs(v):
+    def pointer(v):
         # In the file spec, version is first and the other keys are sorted.
         sortkeyfunc = lambda x: (x[0] != 'version', x)
         items = sorted(pointers[v].iteritems(), key=sortkeyfunc)
@@ -324,7 +324,7 @@
     makemap = lambda v: {
         'file': v,
         'oid': pointers[v].oid(),
-        'lfsattrs': templatekw.hybriddict(lfsattrs(v)),
+        'pointer': templatekw.hybriddict(pointer(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,16 +865,16 @@
   oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   size 29
   x-is-binary 0
-  $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfsattrs % '{key}={value}\n'}'}"
+  $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{pointer % '{key}={value}\n'}'}"
   version=https://git-lfs.github.com/spec/v1
   oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   size=29
   x-is-binary=0
   $ hg --cwd convert_lfs log -r 0 \
-  >    -T '{lfs_files % "{get(lfsattrs, "oid")}\n"}{lfs_files % "{lfsattrs.oid}\n"}'
+  >    -T '{lfs_files % "{get(pointer, "oid")}\n"}{lfs_files % "{pointer.oid}\n"}'
   sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
   sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
-  $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfsattrs}\n"}'
+  $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{pointer}\n"}'
   version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0
   $ hg --cwd convert_lfs \
   >     log -r 'all()' -T '{rev}: {lfs_files % "{file}: {oid}\n"}'


More information about the Mercurial-devel mailing list