Comments
Patch
@@ -193,6 +193,7 @@
command = registrar.command(cmdtable)
templatekeyword = registrar.templatekeyword()
+filesetpredicate = registrar.filesetpredicate()
def featuresetup(ui, supported):
# don't die on seeing a repo with the lfs requirement
@@ -349,6 +350,14 @@
# when writing a bundle via "hg bundle" command, upload related LFS blobs
wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle)
+@filesetpredicate('lfs()')
+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]
+
@templatekeyword('lfs_files')
def lfsfiles(repo, ctx, **args):
"""List of strings. LFS files added or modified by the changeset."""
@@ -154,10 +154,22 @@
$ hg add . -q
$ hg commit -m 'commit with lfs content'
+ $ hg files -r . 'set:added()'
+ large
+ small
+ $ hg files -r . 'set:added() & lfs()'
+ large
+
$ hg mv large l
$ hg mv small s
$ hg commit -m 'renames'
+ $ hg files -r . 'set:copied()'
+ l
+ s
+ $ hg files -r . 'set:copied() & lfs()'
+ l
+
$ echo SHORT > l
$ echo BECOME-LARGER-FROM-SHORTER > s
$ hg commit -m 'large to small, small to large'
@@ -1006,7 +1018,7 @@
The LFS policy stops when the .hglfs is gone
- $ hg rm .hglfs
+ $ mv .hglfs .hglfs_
$ echo 'largefile3' > lfs.test
$ echo '012345678901234567890abc' > nolfs.exclude
$ echo '01234567890123456abc' > lfs.catchall
@@ -1014,6 +1026,18 @@
$ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
4:
+ $ mv .hglfs_ .hglfs
+ $ echo '012345678901234567890abc' > lfs.test
+ $ hg ci -m 'back to lfs'
+ $ hg rm lfs.test
+ $ hg ci -qm 'remove lfs'
+
+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
+
$ cd ..
Unbundling adds a requirement to a non-lfs repo, if necessary.