[PATCH V3] lfs: add the '{raw}' template keyword to '{lfs_files}'

Augie Fackler raf at durin42.com
Wed Jan 17 22:43:10 UTC 2018


On Tue, Jan 16, 2018 at 11:10:43PM +0900, Yuya Nishihara wrote:
> On Tue, 16 Jan 2018 00:40:20 -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 5147a1a111145b239a79765499b58f253b6503ea
> > # Parent  4f66e5c58c21d6a743d1ea69398b7fa2b9ff6419
> > lfs: add the '{raw}' template keyword to '{lfs_files}'
> >
> > Even though it is (probably) weird to have multiline output from a keyword,
> > something similar to this is useful as the public interface to dump the raw
> > pointer content.  I still haven't figured out how to use `hg debugdata` in a non
> > trivial repo, and that will just be another point of aggravation when debugging
> > a problem.  The raw text is accessed directly here, so that we don't mask any
> > problems in the data while deserializing and processing it (or abort).
> >
> > Ultimately, this functionality should probably be provided by something like
> > `hg cat file -T '{raw}'`, and this keyword translated to a dict of the metadata.
> > For non-LFS files, this would do the same thing as normal `hg cat`.  This would
> > be similar (I think) to `git show HEAD:{filename}`.  But with the freeze
> > looming, I won't have time to figure that out, and it could be a valuable
> > debugging tool as this extension gets a wider audience.
> >
> > diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
> > --- a/hgext/lfs/__init__.py
> > +++ b/hgext/lfs/__init__.py
> > @@ -231,6 +231,7 @@
> >      makemap = lambda v: {
> >          'file': v,
> >          'oid': pointers[v].oid(),
> > +        'raw': ctx[v].rawdata(),  # pointersfromctx() filters out removed files
>
> This looks much better than V2.
>
> My two cents, let's call it {rawdata}. "hg cat" provides {data} for fctx.data().

rawdata sgtm>

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list