Hi,
as I outlined in dev group I have been (after long time) updating TSvn hook script and related setting in our repositories.
What I got
----------
consider following repository layout (hopefuly ascii art will get thru)
(root)
- trunk/
- - hooks/ [ext link to (root)/hooks]
- - - hook.js
- - foo/
- branches/
- - test/
- - - hooks/ [ext link to (root)/hooks]
- - - - hooks.js
- - - bar/
- hook/
- - hooks.js
and following WCs
WC-root checked out from (root)
WC-trunk checked out from trunk
WC-branches checked out from branches
WC-test checked out from branches/test
What I want
-----------
for sake of simplicity I will focus on startprecommithook as it is simplest to invoke and I believe all other script will follow same rules.
start commiting any of this will start hook script
WC-root
WC-root/trunk
WC-root/trunk/* - any file within trunk
WC-root/branches
WC-root/branches/*
WC-root/branches/test
wc-trunk
wc-trunk/*
WC-branches
WC-branches/test
WC-branches/test/*
WC-test
WC-test/*
note:
- I'm not picky in what copy script should run as they are same
- I have no particular behavior in mind yet for commiting foo and bar, but invoking script if expected
What I've tried
---------------
note: when taking about what script has run I'm using path from start script confimation dialog, if more paths was tried i dont see it.
note: it seems there is no differece if startprecommithook is set directly or inherited
I will set startcommithook to something like 'wscript %REPOROOT%/hooks/hook.js startcommithook' trying different path
1) WC-root
a) %REPOROOT%/hooks/hook.js
- (root), (root)/*, (root)/*/ -> WC-root/hooks/hook.js = OK
- */*/ e.g. branches/*/ -> WC-root/branches/hooks/hook.js = not good
b) %REPOROOT+%/hooks/hook.js
- NONE commits ask for confirmation to start hook
= not expected
c) ./hooks/hook.js
- (root), trunk, branches\test -> their copy of hook is ran = good
- anything else -> script is not found = expected
2) WC-trunk, WC-test (honesly I tested only WC-trunk, but should be same)
a) %REPOROOT%/hooks/hook.js
- (root), * -> run hook from outside of WC = really bad
- foo/, foo/* -> WC-trunk/hooks/hook.js = OK
- foo/*/ -> WC-trunk/foo/hooks/hook.js = not good
- hooks/ -> no invocation = ok
b) %REPOROOT+%/hooks/hook.js
- any commit (except hooks) run WC-trunk/hooks/hook.js = OK
3) WC-branches
a) %REPOROOT%/hooks/hook.js
- (root), * -> run hook from outside of WC = really bad
- test/, test/* -> WC-branches/hooks/hook.js = does not exists
- test/bar/, test/bar/* -> WC-branches/test/hooks/hook.js = OK
- test/bar/*/, test/bar/*/* -> WC-branches/test/bar/hooks/hook.js = does not exists
b) %REPOROOT+%/hooks/hook.js
- (root), * -> nothing is run = somewhat unexpected
- test/, test/*, test/... -> WC-branches/test/hooks/hook.js = OK
c) %REPOROOT%/test/hooks/hook.js
- (root), *, test/, test/* -> WC-branches/test/hooks/hook.js = OK
- test/bar/, test/bar/* -> WC-branches/test/test/hooks/hook.js = does not exists
- test/bar/*/, test/bar/*/* -> WC-branches/test/bar/test/hooks/hook.js = does not exists
d) %REPOROOT+%/test/hooks/hook.js
- all commits -> WC-branches/test/hooks/hook.js = OK
4) mixing it all together
(root) - %REPOROOT%/hooks/hook.js
- trunk/ - %REPOROOT+%/hooks/hook.js
- - hooks/ [ext link to (root)/hooks]
- - - hook.js
- - foo/
- branches/ - %REPOROOT+%/test/hooks/hook.js (or %REPOROOT%/test/hooks/hook.js)
- - test/ - %REPOROOT+%/hooks/hook.js (also copied when branching)
- - - hooks/ [ext link to (root)/hooks]
- - - - hooks.js
- - - bar/
- hook/
- - hooks.js
In following test it does not matter what folder is WC based on
- (root), *, */ - (root)/hooks/hook.js = OK
- trunk/, trunk/... - trunk/hooks/hook.js = OK
- branches/, branches/... - branches/test/hooks/hook.js = OK
After a long day I finaly got setup which seems workable.
final results and notes
-----------------------
- after all it seems inherited or explicit value gives not the same result (e.g. base folder changes)
- using %REPOROOT+% on (root) does not run any script what is somewhat unexpected
- it would be great to have this solution (or similar) online in documentation there is some cryptic information, but it is somewhat hard to follow (maybe im just getting old) e.g.
https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-propertypage.html#tsvn-dug-propertypage-tsvn-props- %REPOROOT% should never try to run script outside of WC, e.g. WC based on bar
- is there way to disable script for bar if its parrent have script set (for case it is WC base)
- using cancel in 'Approve or reject client-side hook script' gives error 'The hook script returned an error: User cancelled' for this case I like no error message.
- It may be good to have warning (similar to new version is avalable) in commit dialog that hook was not approvedin if 'Don't run' was used
- in Properties dialog
- - you are allowed to use remove on inherited value, but it turn it does nothing (except asking if remove recursively or not)
- - you can see all parents values (i would expect to see only inherited one, at least order should be reversed so closer parent is closer to local value)
- - in context menu having option to turn inherited into local would be nice too
- - in context menu having option andvaced edit will help as well
- trying to run update on multiple WCs may end up with error "Error: The hook script returned an error: Error: The system cannot find the file specified.' with no hint on WC