The student robotics firmwares pull in a library, Rob has implemented this wizzardy with svn externals. Whilst I enjoy the idea, I find the modified output of svn stat quite hard to scan quickly and therefore hard to read:
X lib-fw/flash430/trunk/types
X motor/firmware/trunk/flash430
X motor/firmware/trunk/types
? pwm/svn-stat-dump
? pwm/svn-stat-dumppy
X pwm/firmware/trunk/flash430
X pwm/firmware/trunk/types
M pwm/firmware/trunk/main.c
X jointio/firmware/trunk/flash430
X jointio/firmware/trunk/types
? power/pcb/trunk/gerbers/power-bstop.gbr
? power/pcb/trunk/gerbers/power-tstop.gbr
X power/firmware/trunk/flash430
X power/firmware/trunk/typesPerforming status on external item at ‘motor/firmware/trunk/flash430′
X motor/firmware/trunk/flash430/typesPerforming status on external item at ‘motor/firmware/trunk/flash430/types’
Performing status on external item at ‘motor/firmware/trunk/types’
Performing status on external item at ‘pwm/firmware/trunk/flash430′
X pwm/firmware/trunk/flash430/typesPerforming status on external item at ‘pwm/firmware/trunk/flash430/types’
Performing status on external item at ‘pwm/firmware/trunk/types’
Performing status on external item at ‘lib-fw/flash430/trunk/types’
Performing status on external item at ‘jointio/firmware/trunk/flash430′
X jointio/firmware/trunk/flash430/typesPerforming status on external item at ‘jointio/firmware/trunk/flash430/types’
…
Each external adds at least two lines, three if modified. So five minutes produced this
usage is: svn stat | pystat.py, I think I will add an alias as I use it quite a bit.
giving a cleaner output (the white space is a bit mangled by wordpress! X,M,? etc should all line up, I should probably find a way to fix this):
X lib-fw/flash430/trunk/types
X motor/firmware/trunk/flash430
X motor/firmware/trunk/types
? pwm/svn-stat-dump
? pwm/svn-stat-dumppy
X pwm/firmware/trunk/flash430
X pwm/firmware/trunk/types
M pwm/firmware/trunk/main.c
X jointio/firmware/trunk/flash430
X jointio/firmware/trunk/types
? power/pcb/trunk/gerbers/power-bstop.gbr
? power/pcb/trunk/gerbers/power-tstop.gbr
X power/firmware/trunk/flash430
X power/firmware/trunk/types
ext X motor/firmware/trunk/flash430/types
ext X pwm/firmware/trunk/flash430/types
ext X jointio/firmware/trunk/flash430/types
ext X power/firmware/trunk/flash430/types
This was also one of those things Ive been thinking about for ages, but unwilling to commit the time for such a minor irritant. Once I eventually broke, I decided to time the implementation, it really was sub 5 min including (swift) testing! So yes it was definitely worth it for reduced groan!
Tags: linux, python, svn, svn externals
June 8, 2009 at 9:28 am |
This is one of the places where awk really shines:
BEGIN {tag=” “}
/Performing status on external item/ { tag=”ext”; next}
/^$/ { tag=” “; next }
{ print tag, $0 }
does the same thing as the python and makes it easy to handle other tags cleanly (just add another rule for that tag).