[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: hook to refuse commit if ignored files

From: Alex Teslik <alex_at_acatysmoof.com>
Date: 2005-12-20 23:39:49 CET

---------- Original Message -----------
From: Paul Koning <pkoning@equallogic.com>
To: alex@acatysmoof.com
Cc: users@subversion.tigris.org
Sent: Tue, 20 Dec 2005 16:01:16 -0500
Subject: Re: hook to refuse commit if ignored files

> >>>>> "Alex" == Alex Teslik <alex@acatysmoof.com> writes:
>
> Alex> I'm trying to make a pre-commit hook that refuses the commit if
> Alex> there are any files that are of the ignore type (the ones that
> Alex> show with a "?" in front of them when you run 'svn status'
> Alex> before commit). I don't want committers to forget to 'svn add'
> Alex> those files. How can I test for this case using svnlook (or any
> Alex> other method)?
>
> You can't. Hook scripts run on the server. When you say "svn commit"
> the server is told what will be committed, which by definition does
> NOT include any "?" files. So at the server end you can't tell, and
> you don't know what is in the client's working directory. You only
> know what files the client said should be committed right now.
>
> paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
------- End of Original Message --------

Bummer. This makes it really easy to do a commit whilst forgetting to 'svn
add' some files you were supposed to...not that I would ever forget to do
that...nope, never.
Mabye I'll wrap 'svn commit' with something like:

if (`svn status | grep '^?' | awk '{print $2}' | wc -l` > 0) then
    echo "You have forgotten to process some files - commit aborted"
else
   svn commit
endif

or something similar. Further ideas welcome.

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Dec 25 03:00:01 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.