Patchwork [2,of,5,RFC] lfs: add the '{oid}' template keyword to '{lfs_files}'

login
register
mail settings
Submitter Matt Harbison
Date Jan. 15, 2018, 5:13 a.m.
Message ID <op.zcu94hc39lwrgf@envy>
Download mbox | patch
Permalink /patch/26757/
State RFC, archived
Headers show

Comments

Matt Harbison - Jan. 15, 2018, 5:13 a.m.
On Sun, 14 Jan 2018 23:58:49 -0500, Matt Harbison <mharbison72@gmail.com>  
wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@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 RFCs here are really only 3 and 5.  But in an early version of this, I  
tried a couple ways to test, and didn't clean it up completely from the  
previous one.  Maybe this is a parser problem? (Notice the unbalanced ')'  
outside of the quotes, which then seems to make both it and the closing  
'}' visible.)

    $ grep 'lfs' convert_lfs/.hg/requires
    lfs
Yuya Nishihara - Jan. 15, 2018, 3:01 p.m.
On Mon, 15 Jan 2018 00:13:19 -0500, Matt Harbison wrote:
> previous one.  Maybe this is a parser problem? (Notice the unbalanced ')'  
> outside of the quotes, which then seems to make both it and the closing  
> '}' visible.)

> +  >     log -r 'all()' -T '{rev}: {lfs_files % "{lfs_file}: {oid}\n")}\n'
> +  0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
> +  )}

Yeah it is. Perhaps the string-part parser has to revalidate the terminator
character '}' of an expression.

Patch

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,14 @@ 
    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")}\n'
+  0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  )}
+  1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024
+  )}
+  2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943
+  )}