Submitter | Matt Harbison |
---|---|
Date | Jan. 16, 2018, 5:40 a.m. |
Message ID | <5147a1a111145b239a79.1516081220@Envy> |
Download | mbox | patch |
Permalink | /patch/26781/ |
State | Deferred, archived |
Headers | show |
Comments
On Tue, 16 Jan 2018 00:40:20 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@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().
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@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@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
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 } # 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 @@ -859,6 +859,12 @@ oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size 29 x-is-binary 0 + $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{raw}\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"}' 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024