Submitter | Matt Harbison |
---|---|
Date | Feb. 11, 2018, 2:41 a.m. |
Message ID | <8009ea6019880cccef2d.1518316889@Envy> |
Download | mbox | patch |
Permalink | /patch/27522/ |
State | Accepted |
Headers | show |
Comments
On Sat, 10 Feb 2018 21:41:29 -0500, Matt Harbison <mharbison72@gmail.com> wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@yahoo.com> > # Date 1517097753 18000 > # Sat Jan 27 19:02:33 2018 -0500 > # Node ID 8009ea6019880cccef2dd48ea3afad32989f3073 > # Parent 589f4ea15c31383964e2b7d812bb5431b7dd682e > lfs: teach the 'lfs()' fileset to handle removed files > > The callstatus setting is required to notice the removal of 'lfs.test' > in rev 6 > in the tests, even though this isn't directly calling mctx.status(). > However, > it's not needed to get the results in the tests for `hg status`, so I'm > probably > missing something. In addition to this oddity, I can't get `hg files 'set:lfs()'` to work. The pointerfromctx() method only works for commits, so I special cased `ctx.rev() == None` to just test the name and size against the lfs.track matcher. (`hg files 'set:lfs()'` seems like a reasonable way to test the config before committing.) The proper files are added to the list comprehension here, but the `[f for f in dmap if match(f)]` in dirstate.matches() fails each match(f).
On Sat, 10 Feb 2018 22:07:04 -0500, Matt Harbison wrote: > > # HG changeset patch > > # User Matt Harbison <matt_harbison@yahoo.com> > > # Date 1517097753 18000 > > # Sat Jan 27 19:02:33 2018 -0500 > > # Node ID 8009ea6019880cccef2dd48ea3afad32989f3073 > > # Parent 589f4ea15c31383964e2b7d812bb5431b7dd682e > > lfs: teach the 'lfs()' fileset to handle removed files Queued, thanks. > > The callstatus setting is required to notice the removal of 'lfs.test' > > in rev 6 > > in the tests, even though this isn't directly calling mctx.status(). > > However, > > it's not needed to get the results in the tests for `hg status`, so I'm > > probably > > missing something. That's how a subset computed. ctx.walk() wouldn't include removed files. > In addition to this oddity, I can't get `hg files 'set:lfs()'` to work. > The pointerfromctx() method only works for commits, so I special cased > `ctx.rev() == None` to just test the name and size against the lfs.track > matcher. (`hg files 'set:lfs()'` seems like a reasonable way to test the > config before committing.) Seems fine. > The proper files are added to the list > comprehension here, but the `[f for f in dmap if match(f)]` in > dirstate.matches() fails each match(f). No idea.
Patch
diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -350,13 +350,13 @@ # when writing a bundle via "hg bundle" command, upload related LFS blobs wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle) -@filesetpredicate('lfs()') +@filesetpredicate('lfs()', callstatus=True) def lfsfileset(mctx, x): """File that uses LFS storage.""" # i18n: "lfs" is a keyword fileset.getargs(x, 0, 0, _("lfs takes no arguments")) return [f for f in mctx.subset - if wrapper.pointerfromctx(mctx.ctx, f) is not None] + if wrapper.pointerfromctx(mctx.ctx, f, removed=True) is not None] @templatekeyword('lfs_files') def lfsfiles(repo, ctx, **args): diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -162,6 +162,11 @@ $ hg mv large l $ hg mv small s + $ hg status 'set:removed()' + R large + R small + $ hg status 'set:removed() & lfs()' + R large $ hg commit -m 'renames' $ hg files -r . 'set:copied()' @@ -169,6 +174,11 @@ s $ hg files -r . 'set:copied() & lfs()' l + $ hg status --change . 'set:removed()' + R large + R small + $ hg status --change . 'set:removed() & lfs()' + R large $ echo SHORT > l $ echo BECOME-LARGER-FROM-SHORTER > s @@ -1042,11 +1052,11 @@ 2 lfs.catchall: sha256:d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9 2 lfs.test: sha256:5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c -TODO: This should notice the deleted lfs files in rev 6 $ hg log -r 'file("set:lfs()")' -T '{rev} {join(lfs_files, ", ")}\n' 2 lfs.catchall, lfs.test 3 lfs.catchall, lfs.test 5 lfs.test + 6 lfs.test $ cd ..