On Monday 06 Sep 2010, Giulio Troccoli wrote:
> Linedata Limited
> Registered Office: 85 Gracechurch St., London, EC3V 0AA
> Registered in England and Wales No 3475006 VAT Reg No 710 3140 03
>
> -----Original Message-----
>
> > From: Campbell Allan [mailto:campbell.allan_at_sword-ciboodle.com]
> > Sent: 06 September 2010 11:40
> > To: users_at_subversion.apache.org
> > Cc: Giulio Troccoli; 'Daniel Becroft'
> > Subject: Re: Transaction and revision numbers
> >
> > On Monday 06 Sep 2010, Giulio Troccoli wrote:
> > > The class will be used by both the pre- and post-commit
> >
> > hooks, hence
> >
> > > the need to distinguish between transaction or revision.
> >
> > And I would
> >
> > > like to do it by just looking at the transaction/revision number.
> > >
> > > I think transactions are in the format of 9999999-9 (where 9 is any
> > > single
> > > number) while revisions are in the format 99999. If that's
> >
> > true, then
> >
> > > I can check for the dash and I'm done. Can anyone confirm it to me?
> > >
> > > Giulio
> >
> > I'm not sure about the transaction number always having a
> > dash but another alternative approach could be to check the
> > script name. So long as the script is a link from
> > post-commit/pre-commit then it's name will be different and
> > can be used to distinguish the two uses. I've used this trick
> > so that one shell script logs changes from a post-commit,
> > post-revprop-change (which also has different parameters) and CVS.
>
> I don't understand what you're saying here. However I have decided to
> follow another approach.
>
> The calling script will pass a hash specifying either the transaction or
> the revision. Something like
>
> SVN::get_author({ revision => $rev }) or SVN::get_author({ transaction =>
> $txn })
>
> So, get_author will know what to do.
>
> Giulio
That's a good idea. Just to clarify my approach, perhaps an example is better.
Imagine the following script was softlinked from the pre and post commit hook
scripts:
#!/usr/bin/perl
if ( $0 =~ /(^|\/)post-commit$/ ) {
print "post-commit actions\n";
}
elsif ( $0 =~ /(^|\/)pre-commit$/ ) {
print "pre-commit actions\n";
}
then when invoked $0 will contain either pre-commit or post-commit. It's a
feature of links that some unix utilities make use of so there can be a
single binary that has multiple modes of operation change which it does
depending on the name it was invoked as. For example bunzip2 is a link to
bzip2 but implies the -d option. Unfortunately I only know of it working on
unix systems.
Campbell
--
__________________________________________________________________________________
Sword Ciboodle is the trading name of ciboodle Limited (a company
registered in Scotland with registered number SC143434 and whose
registered office is at India of Inchinnan, Renfrewshire, UK,
PA4 9LH) which is part of the Sword Group of companies.
This email (and any attachments) is intended for the named
recipient(s) and is private and confidential. If it is not for you,
please inform us and then delete it. If you are not the intended
recipient(s), the use, disclosure, copying or distribution of any
information contained within this email is prohibited. Messages to
and from us may be monitored. If the content is not about the
business of the Sword Group then the message is neither from nor
sanctioned by us.
Internet communications are not secure. You should scan this
message and any attachments for viruses. Under no circumstances
do we accept liability for any loss or damage which may result from
your receipt of this email or any attachment.
__________________________________________________________________________________
Received on 2010-09-06 14:26:49 CEST