##// END OF EJS Templates
lfs: add the '{lfsattrs}' template keyword to '{lfs_files}'...
Matt Harbison -
r35749:f58245b9 default
parent child Browse files
Show More
@@ -97,6 +97,7 b' from mercurial import ('
97 scmutil,
97 scmutil,
98 templatekw,
98 templatekw,
99 upgrade,
99 upgrade,
100 util,
100 vfs as vfsmod,
101 vfs as vfsmod,
101 wireproto,
102 wireproto,
102 )
103 )
@@ -311,9 +312,16 b' def lfsfiles(repo, ctx, **args):'
311 pointers = wrapper.pointersfromctx(ctx) # {path: pointer}
312 pointers = wrapper.pointersfromctx(ctx) # {path: pointer}
312 files = sorted(pointers.keys())
313 files = sorted(pointers.keys())
313
314
315 def lfsattrs(v):
316 # In the file spec, version is first and the other keys are sorted.
317 sortkeyfunc = lambda x: (x[0] != 'version', x)
318 items = sorted(pointers[v].iteritems(), key=sortkeyfunc)
319 return util.sortdict(items)
320
314 makemap = lambda v: {
321 makemap = lambda v: {
315 'file': v,
322 'file': v,
316 'oid': pointers[v].oid(),
323 'oid': pointers[v].oid(),
324 'lfsattrs': templatekw.hybriddict(lfsattrs(v)),
317 }
325 }
318
326
319 # TODO: make the separator ', '?
327 # TODO: make the separator ', '?
@@ -865,6 +865,17 b" there's no 'lfs' destination repo requir"
865 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
865 oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
866 size 29
866 size 29
867 x-is-binary 0
867 x-is-binary 0
868 $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfsattrs % '{key}={value}\n'}'}"
869 version=https://git-lfs.github.com/spec/v1
870 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
871 size=29
872 x-is-binary=0
873 $ hg --cwd convert_lfs log -r 0 \
874 > -T '{lfs_files % "{get(lfsattrs, "oid")}\n"}{lfs_files % "{lfsattrs.oid}\n"}'
875 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
876 sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
877 $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfsattrs}\n"}'
878 version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0
868 $ hg --cwd convert_lfs \
879 $ hg --cwd convert_lfs \
869 > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {oid}\n"}'
880 > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {oid}\n"}'
870 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
881 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
General Comments 0
You need to be logged in to leave comments. Login now