##// END OF EJS Templates
lfs: add a fileset for detecting lfs files...
Matt Harbison -
r36008:eefb5d60 default
parent child Browse files
Show More
@@ -193,6 +193,7 b' cmdtable = {}'
193 command = registrar.command(cmdtable)
193 command = registrar.command(cmdtable)
194
194
195 templatekeyword = registrar.templatekeyword()
195 templatekeyword = registrar.templatekeyword()
196 filesetpredicate = registrar.filesetpredicate()
196
197
197 def featuresetup(ui, supported):
198 def featuresetup(ui, supported):
198 # don't die on seeing a repo with the lfs requirement
199 # don't die on seeing a repo with the lfs requirement
@@ -349,6 +350,14 b' def extsetup(ui):'
349 # when writing a bundle via "hg bundle" command, upload related LFS blobs
350 # when writing a bundle via "hg bundle" command, upload related LFS blobs
350 wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle)
351 wrapfunction(bundle2, 'writenewbundle', wrapper.writenewbundle)
351
352
353 @filesetpredicate('lfs()')
354 def lfsfileset(mctx, x):
355 """File that uses LFS storage."""
356 # i18n: "lfs" is a keyword
357 fileset.getargs(x, 0, 0, _("lfs takes no arguments"))
358 return [f for f in mctx.subset
359 if wrapper.pointerfromctx(mctx.ctx, f) is not None]
360
352 @templatekeyword('lfs_files')
361 @templatekeyword('lfs_files')
353 def lfsfiles(repo, ctx, **args):
362 def lfsfiles(repo, ctx, **args):
354 """List of strings. LFS files added or modified by the changeset."""
363 """List of strings. LFS files added or modified by the changeset."""
@@ -154,10 +154,22 b' enabled adds the lfs requirement'
154 $ hg add . -q
154 $ hg add . -q
155 $ hg commit -m 'commit with lfs content'
155 $ hg commit -m 'commit with lfs content'
156
156
157 $ hg files -r . 'set:added()'
158 large
159 small
160 $ hg files -r . 'set:added() & lfs()'
161 large
162
157 $ hg mv large l
163 $ hg mv large l
158 $ hg mv small s
164 $ hg mv small s
159 $ hg commit -m 'renames'
165 $ hg commit -m 'renames'
160
166
167 $ hg files -r . 'set:copied()'
168 l
169 s
170 $ hg files -r . 'set:copied() & lfs()'
171 l
172
161 $ echo SHORT > l
173 $ echo SHORT > l
162 $ echo BECOME-LARGER-FROM-SHORTER > s
174 $ echo BECOME-LARGER-FROM-SHORTER > s
163 $ hg commit -m 'large to small, small to large'
175 $ hg commit -m 'large to small, small to large'
@@ -1006,7 +1018,7 b' The .hglfs file works when tracked'
1006
1018
1007 The LFS policy stops when the .hglfs is gone
1019 The LFS policy stops when the .hglfs is gone
1008
1020
1009 $ hg rm .hglfs
1021 $ mv .hglfs .hglfs_
1010 $ echo 'largefile3' > lfs.test
1022 $ echo 'largefile3' > lfs.test
1011 $ echo '012345678901234567890abc' > nolfs.exclude
1023 $ echo '012345678901234567890abc' > nolfs.exclude
1012 $ echo '01234567890123456abc' > lfs.catchall
1024 $ echo '01234567890123456abc' > lfs.catchall
@@ -1014,6 +1026,18 b' The LFS policy stops when the .hglfs is '
1014 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1026 $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n'
1015 4:
1027 4:
1016
1028
1029 $ mv .hglfs_ .hglfs
1030 $ echo '012345678901234567890abc' > lfs.test
1031 $ hg ci -m 'back to lfs'
1032 $ hg rm lfs.test
1033 $ hg ci -qm 'remove lfs'
1034
1035 TODO: This should notice the deleted lfs files in rev 6
1036 $ hg log -r 'file("set:lfs()")' -T '{rev} {join(lfs_files, ", ")}\n'
1037 2 lfs.catchall, lfs.test
1038 3 lfs.catchall, lfs.test
1039 5 lfs.test
1040
1017 $ cd ..
1041 $ cd ..
1018
1042
1019 Unbundling adds a requirement to a non-lfs repo, if necessary.
1043 Unbundling adds a requirement to a non-lfs repo, if necessary.
General Comments 0
You need to be logged in to leave comments. Login now