subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexey Neyman <sti...@att.net>
Subject Re: Creating a pre-commit hook for copy operations
Date Fri, 15 Aug 2014 22:51:32 GMT
Another (and possibly easier) way is to use fs.paths_changed2 - the entries in 
that hash have copyfrom_path/copyfrom_rev fields indicating the source of the 
copy.

Regards,
Alexey.

On Friday, August 15, 2014 11:24:18 am Keath Milligan wrote:
> Thanks, Eric. svnlook gave me the clue I needed. I look at its source and
> found that I had been on the right track using ChangeCollector and replay2,
> but there was an error in my code. Once I got that fixed, my hook worked.
> 
> On Fri, Aug 15, 2014 at 12:59 PM, Eric Johnson <eric@tibco.com> wrote:
> > I had a similar problem of needing to look for copies. Rather than deal
> > with the complexity of the API, I simply relied on the "svnlook" command
> > output.
> > 
> > Specifically, I used "svnlook --transaction ${tx_id} changed
> > --copy-info", and parsed the result.
> > 
> > Eric
> > 
> > 
> > On Fri, Aug 15, 2014 at 7:15 AM, Keath Milligan <keath@keathmilligan.net>
> > 
> > wrote:
> >> We're using Subversion 1.8.3 and need to create a pre-commit hook that
> >> checks copy operations (specifically branch creation) for certain
> >> conditions. Specifically, we want to be able to prevent users from
> >> creating branches in the wrong locations and similar errors.
> >> 
> >> To accomplish this, we need to know the source and destination paths of
> >> the copy operation. Our current pre-commit hook (written in Python) uses
> >> a delta.Editor subclass to check other things. We tried overriding the
> >> add_directory method, which has a copyfrom_path argument -- this would
> >> have been perfect, but this argument is always empty.
> >> 
> >> We also tried using the repos.Changecollector and repos.replay2, but
> >> this doesn't seem to give us information about the pending commit --
> >> perhaps we are doing it wrong.
> >> 
> >> Any suggestion would be much appreciated.
> >> 
> >> Thanks

Mime
View raw message