Re: New to subversion, need to find documentation on writing hooks

2012-05-20 Thread Les Mikesell
On Sun, May 20, 2012 at 4:16 PM, Ted Byers  wrote:

>  I have read arguments that recommend
> against this, claiming it can slow down commits, but then I am more
> concerned about code quality, and always having a codebase, which to me
> includes all tests, that compiles and runs properly than I am in the
> convenience of any programmers working on the project.

I suspect that everyone involved would be happier if you implement
that in a continuous integration tool like jenkins that will still
check everything (and can do a lot more) but does not interfere with
commits.And use branches/tags to identify the production quality
versions so your programmers can get some work done.

-- 
  Les Mikesell
 lesmikes...@gmail.com


Re: New to subversion, need to find documentation on writing hooks

2012-05-20 Thread David Chapman

On 5/20/2012 2:16 PM, Ted Byers wrote:


I have just installed subversion on a Ubuntu VM, and trying to learn 
how to administer both.  I have successfully created my first VN 
repository.  :-)


Now, I have read through the documentation a couple times, and know 
what hooks are and why they're used, but I am not clear on how to 
write one as the examples I have found so far are written in 
programming languages I don't know (such as Python).


In the first project I am going to put into this repository, I am 
writing a test suite based on Boost's Test library (written in C++).  
What I want to do is write a program that assesses code coverage, so 
that all new code has at least one unit test, and then require that 
the codebase, including all existing and new tests,  compile and 
execute successfully; and have a precommit hook that prevents a commit 
unless this test suite program indicates that the tests all passed.  I 
have read arguments that recommend against this, claiming it can slow 
down commits, but then I am more concerned about code quality, and 
always having a codebase, which to me includes all tests, that 
compiles and runs properly than I am in the convenience of any 
programmers working on the project.  I also write in Perl and 
JavaScript (and not so much anymore in Java or C#), so I will want the 
same requirement on all code in all the languages I routinely use.



The usual convention is to put the checks in the post-commit hook, then 
back out offending changes if any.  Otherwise commits can grind to a halt.


I once worked at a company where the pre-commit test suite (not part of 
a hook) ran for an hour.  We were supposed to ensure that no other 
changes had been made to the affected modules before the commit.  
However, this would sometimes require several iterations (a dozen 
developers and a couple dozen modules under active, though unrelated, 
enhancement efforts meant lots of "file has been changed" conflicts at 
commit time).  Occasionally we simply had to merge, compile, commit, and 
then rerun the test suite.  (Yes, I would have liked to reduce that 
suite to 30 seconds or less, but that was a much larger problem than 
what I could change at that company.)


--
David Chapman  dcchap...@acm.org
Chapman Consulting -- San Jose, CA
Software Development Done Right.
www.chapman-consulting-sj.com



Re: New to subversion, need to find documentation on writing hooks

2012-05-20 Thread Ryan Schmidt

On May 20, 2012, at 16:16, Ted Byers wrote:

> I have just installed subversion on a Ubuntu VM, and trying to learn how to 
> administer both.  I have successfully created my first VN repository.  :-)
>  
> Now, I have read through the documentation a couple times, and know what 
> hooks are and why they're used, but I am not clear on how to write one as the 
> examples I have found so far are written in programming languages I don't 
> know (such as Python).
>  
> In the first project I am going to put into this repository, I am writing a 
> test suite based on Boost's Test library (written in C++).  What I want to do 
> is write a program that assesses code coverage, so that all new code has at 
> least one unit test, and then require that the codebase, including all 
> existing and new tests,  compile and execute successfully; and have a 
> precommit hook that prevents a commit unless this test suite program 
> indicates that the tests all passed.  I have read arguments that recommend 
> against this, claiming it can slow down commits, but then I am more concerned 
> about code quality, and always having a codebase, which to me includes all 
> tests, that compiles and runs properly than I am in the convenience of any 
> programmers working on the project.  I also write in Perl and JavaScript (and 
> not so much anymore in Java or C#), so I will want the same requirement on 
> all code in all the languages I routinely use.
>  
> Can anyone either show me how to write such a pre-commit hook, or point me to 
> examples that would show how to do this?

You should be able to write Subversion hook scripts in whatever language you 
like. I used PHP before, but now that I've jumped into using node.js for web 
development, writing one in JavaScript would be fun. I don't have an example 
handy at this time. But there should be tons of examples using Perl.



New to subversion, need to find documentation on writing hooks

2012-05-20 Thread Ted Byers
I have just installed subversion on a Ubuntu VM, and trying to learn how to
administer both.  I have successfully created my first VN repository.  :-)

 

Now, I have read through the documentation a couple times, and know what
hooks are and why they're used, but I am not clear on how to write one as
the examples I have found so far are written in programming languages I
don't know (such as Python).

 

In the first project I am going to put into this repository, I am writing a
test suite based on Boost's Test library (written in C++).  What I want to
do is write a program that assesses code coverage, so that all new code has
at least one unit test, and then require that the codebase, including all
existing and new tests,  compile and execute successfully; and have a
precommit hook that prevents a commit unless this test suite program
indicates that the tests all passed.  I have read arguments that recommend
against this, claiming it can slow down commits, but then I am more
concerned about code quality, and always having a codebase, which to me
includes all tests, that compiles and runs properly than I am in the
convenience of any programmers working on the project.  I also write in Perl
and JavaScript (and not so much anymore in Java or C#), so I will want the
same requirement on all code in all the languages I routinely use.

 

Can anyone either show me how to write such a pre-commit hook, or point me
to examples that would show how to do this?

 

Thanks

 

Cheers

 

Ted

 



Behavious of svnlook diff --diff-copy-from

2012-05-20 Thread Sven Köhler
Hi,

Consider the following output produced with svnlook WITHOUT using
--diff-copy-from:

Copied: trunk/test2.txt (from rev 6, trunk/test.txt)
===
--- trunk/test2.txt (rev 0)
+++ trunk/test2.txt 2012-05-20 13:20:40 UTC (rev 7)
@@ -0,0 +1 @@
+test2

Now test2.txt is identical to test.txt (I simply created it with svn cp
test.txt test2.txt and committed it). Now the behaviour of svnlook is,
that when I add --diff-copy-from to the mix, then the output of
"svnlook" is empty.

At least for creating commit emails (I'm using svnnotify), this is not
an ideal behaviour. Valueable information (test2.txt has been created by
copying test.txt) is omitted form the output.

What I actually expected as the output of svnlook diff --diff-copy-from
was something like this:

Copied: trunk/test2.txt (from rev 6, trunk/test.txt)
===
no diff, files are identical


Obviously, --no-diff-added and --no-diff-removed behave the same way.
They omit any added/deleted files completely. The output does not only
not contain a diff of the files, it also does not contain any
information that a file has been added or deleted.

I wish for a mode, in which "svnlook diff" would merely omit the actual
diff and not the information that files have been added/deleted or where
they were copied from.

I realize, that I can use "svnlook changed --copy-info" to obtain the
information I want. On the other hand, that information is seperate to
the diffs. And currently svnnotify doesn't support --copy-info which is
something I should probably talk about with the svnnotify developer.


Regards,
  Sven