On 5/11/05, Scott Simpson <Scott.Simpson@computer.org> wrote:
> OK. So it looks like I'll have to add the property for my Change Request
> (CR) number on the client side. I could write a Perl script to intercept
> all the command line arguments and have all the users use that. This
> would have the disadvantage that I'd have to parse the "svn" command for
> file names and such. Yuck. Also, I need to handle three clients:
>
> On Windows: TortoiseSVN and Eclipse (and maybe command line)
> On Linux: Command line and Eclipse
>
> How would I intercept all three?
It has to do with the way Subversion was designed.
Other CM systems like ClearCase offer something similar to hooks, but
these "hooks" are run on the client's machine. This has the advantage
of having all of the client's data, and to be able to easily interact
with the client. For example, ask for a CR number to be fixed.
It also has a really big disadvantage: You'd have to write "hook"
scripts for every single platform someone might use. Even Perl scripts
aren't universal in this respect. Windows doesn't come with Perl, and
the directory structure between PCs and Windows is different.
ClearCase takes care of this by specifying separate hook scripts for
Windows clients and Unix clients.
Plus, who says that the scripting language is configured correctly? Or
even installed? And, there is alway some joker who writes their own
"hook script" to go around your restrictions. Imagine on a PC, someone
wrote a "Perl" program that always returns an exit code of zero and
puts it first in his PATH. Now, any "hooks" you attempt to execute
would succeed no matter what because they are running with his "Perl"
script.
Because Subversion hooks are run on the Server side, there is no need
to worry about compatibility problems. You write a script that works
on your server. As anyone who has worked with ClearCase triggers will
tell you, this is a big advantage. A person could download a
Subversion client for an Etch-A-Sketch and do their work there for all
you care. You don't have to worry whether there is an Etch-A-Sketch
version of Perl.
Of course, that means that Subversion cannot have an interactive
conversation with the client. For example, I'd love to be able to
request a bug number when a commit is done. Can't be done. The best I
can do is reject the commit and chide the user for not doing things
the right way.
By the way, I was too shocked by the fact that I cannot add or modify
properties to files without a working directory. I can make
directories, copy files, etc. without a working directory, but
apparently I can not add or change properties.
In theory, you could write a hook script that would take a look at the
property of the file being committed, then if you want, do a checkout
to create a working directory that contains that file on your server,
edit the property, do a commit, and then clean up. But, that's a lot
of work just to change a single property.
--
David Weintraub
qazwart@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu May 12 18:58:02 2005