简体   繁体   中英

Tortoise Hg: Configure mercurial to track only the size of the file for large files

Is there a function or extension in mercurial that will check and compare only the size of the file when it exceeds a certain amount? The largefiles extension doesn't seem to help me cause it still tracks the latest version of the large file. I want it to track the size only.

I know it's not that hard to implement as a script but I'm just checking if someone already did it before.

This is nothing mercurial does out of the box. There are a lot of edge cases whose behavior you're not describing (like: "what happens when a file was below the threshold and then later grows past it -- is it removed?")

You could, however, quite easily set up a precommit hook that writes the size of large files to a file that is tracked in your repo. Something like this (untested) in your repo's .hg/hgrc would do it:

[hooks]
precommit.recordsize = find $(hg root) -type f -size 100M | xargs ls -l > $(hg root)/big_files

That would update a list of all the files greater than 100M in size in a file named big_files in the root of your repo along with their details.

Ignoring/not-committing the files could be done the same way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM