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

Re: post commit script and svnlook (log and changed are empty)

From: Mark Bohlman <mbohlman_at_tcicredit.com>
Date: 2004-07-07 16:44:00 CEST

Tim Diggins wrote:
> Hi -
>
> I've made a very simple script which mails me info about each commit to a
> SVN repository.
> it uses "svnlook changed -r N path", "svnlook log -r N path" and "svnlook
> author -r N path" to compose the message
>
> When I run it from the command line it works fine - but when I add it to my
> postcommit hook, the changed and log entries are empty (author is fine, and
> correct). I've tried adding some sleep (time.sleep(2) in a loop) but still
> no dice - after waiting 20s there's still nothing in the svnlook changed.
>
> So I've probably missed something... But can't work out what it is (as I'm
> using svn+ssh, I don't think it can be a permissions thing).
>
> Thanks
>
> Tim
>
> BTW, before someone asks - I haven't used any of the existing
> tools/hook-scripts as I haven't yet managed to install svn module into
> python and I can't get the perl script to work (maybe because I did an
> export from the HEAD of svn of subversion, cause wasn't in my default
> (darwinports) install), and I've got such a small developer base (2) and
> such limited needs, I thought it might -- might-- be quicker to just hack
> out a quick script... now I'm just "hooked".
>
> ------------------------------------------------------
> fyi - more details:
> ------------------------------------------------------
> svn running on: osx 10.3 panther
> client running on: windows xp (tortoisesvn)
> script written in python (2.3)...
>
> ------------------------------------------------------
> Python excerpt:
> ------------------------------------------------------
> def svnlook(what, rev, repos):
> f=os.popen("""svnlook %s -r %s %s""" % (what, rev,repos), "r")
> val = "".join(f.readlines())
> f.close()
> return val
>
> for i in range(10):
> changed = svnlook("changed", rev, repos)
> if changed:
> break
> time.sleep(2)
> if not changed:
> errors.append("No value for changed")
>
> log = svnlook("log", rev, repos).strip()
> author = svnlook("author", rev,repos).strip()
>
> f=os.popen("""mail -s "SVN: %s (r%s: %s)" %s""" %(log, rev, author,
> mails),"w"
> )
> f.write("%-20s %s\n" % ("repos:", repos))
> f.write("%-20s %s\n" %("revision:", rev))
> f.write("%-20s %s\n" % ("log message:",log))
> f.write("changes:\n" )
> f.write(changed)
> f.write("\n\n")
> if errors:
> f.write("errors:\n")
> f.write("\n".join(errors))
> f.write("\n")
> f.close()
> ------------------------------------------------------
> Tim Diggins
> http://www.red56.co.uk/people/tim

Best bet is to make sure that the paths in the hook script are fully
qualified as the environment that the script receives is minimal. This
is what I had to do to get mine working properly.
-- Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jul 7 16:44:26 2004

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.