hammer history ls

Jost Tobias Springenberg jspringe at uos.de
Mon Feb 16 06:01:09 PST 2009


Hi all,
I came across a feature that was not implemented and that I desperately needed yesterday,
while fixing a companys backup server.

Sometimes it is extremely useful to be able to list all versions of a bunch of files.
For this purpose there exists the hamer history command. 
If you however only need to know the number of different versions of some files 
between two timestamps it is not exactly as nice to use as one might think :), as you get a lot more
and the output is not really well structured.

I needed exactly this and started calling hammer history on a lot of files and then comparing
the transaction ids and so forth, which was not a lot of fun.
I realized that all I needed was some kind of ls with the number of different versions for every
filehandle included in the output. 
I thus hacked the ls command and with a few lines of code added history functionality such that 
you can now use it like this:

> ls --hist /

will result in a usual ls with history count added to the output.

> ls --hist --startid 0x...... --endid 0x.......

will only count the number of different versions between startid and endid.

I works fine, I do however realize that this is a bad hack, which makes ls dependant on hammer if compiled with the addition
and is not very nice in general regarding seperation of concerns.
I still think that this feature is extremely useful and should be integrated in some way
(maybe it is better to add some flags to the hammer history command).
Any opinions on that one ( maybe something like this is already implemented and I just did not find it ;))?

Best Regards,
	Tobias






More information about the Users mailing list