[PATCH V2] lfs: add the '{lfsattrs}' template keyword to '{lfs_files}'

Yuya Nishihara yuya at tcha.org
Sat Jan 20 02:38:11 EST 2018


On Sat, 20 Jan 2018 01:34:49 -0500, Matt Harbison wrote:
> On Fri, 19 Jan 2018 07:21:30 -0500, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> > On Fri, 19 Jan 2018 00:05:42 -0500, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison at yahoo.com>
> >> # Date 1515967224 18000
> >> #      Sun Jan 14 17:00:24 2018 -0500
> >> # Node ID fccf09e44f5124abf18ae898fab553ea6d91e951
> >> # Parent  45b678bf3a787085d56fad5bee494e0c160aa120
> >> lfs: add the '{lfsattrs}' template keyword to '{lfs_files}'
> >
> > Queued updated version, thanks.
> >
> >> I liked {pointer} better, but couldn't make it work with the  
> >> singular/plural
> >> forms.
> >
> > I think {pointer} is okay here since its singular form is ({key},  
> > {value}).
> 
> OK, I'll rename after the freeze.

I think it's okay to rename that before cutting rc. Can you send a patch?

> >> @@ -303,6 +304,8 @@
> >>      # when writing a bundle via "hg bundle" command, upload related  
> >> LFS blobs
> >>      wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle)
> >>
> >> +    templatekw.defaulttempl['lfsattr'] = '{key}={value}'
> >
> > This isn't needed. Dropped.
> 
> Does that mean the envvar entry isn't needed?  Somehow, the output I was  
> getting was all of the keys run together, and that made me think of  
> envvar.  (Unfortunately, I didn't commit the code, so I can't go back to  
> see what exactly was wrong.)

showdict|list() requires defaulttempl entry to support old-style list
templates. hybriddict|list() doesn't.

> I wonder if this strategy is wrong in general.  Regular templates have  
> {files}, {file_adds}, {file_copies}, {file_copies_switch}, {file_dels},  
> {file_mods}, and {files(PATTERN)}.  It would be silly to copy all of  
> that.  But filters seem only text oriented.  Could a hypothetical  
> {lfs_files()}
> filter all of these to lfs only,

A unary template function can acts as a filter.

> and tack {pointer} and {oid} on to each
> entry somehow?

Alternatively, we could add pointer and oid to files entry only when it
is backed by lfs.


More information about the Mercurial-devel mailing list