Fix compiler warning due to missing function prototype.
[svn.git] / tools / hook-scripts / mailer / tests / mailer-tweak.py
blob10c0053ea6031ef1ed35c3c0ffdbb0cdfaacd2a5
1 #!/usr/bin/env python
3 # mailer-tweak.py: tweak the svn:date and svn:author properties
4 # on all revisions
6 # We need constant dates and authors for the revisions so that we can
7 # consistently compare an output against a known quantity.
9 # USAGE: ./mailer-tweak.py REPOS
13 import sys
14 import os
15 import getopt
17 from svn import fs, core
19 DATE_BASE = 1000000000
20 DATE_INCR = 10000
23 def tweak_dates(pool, home='.'):
24 db_path = os.path.join(home, 'db')
25 if not os.path.exists(db_path):
26 db_path = home
28 fsob = fs.new(None, pool)
29 fs.open_berkeley(fsob, db_path)
31 for i in range(fs.youngest_rev(fsob, pool)):
32 # convert secs into microseconds, then a string
33 date = core.svn_time_to_cstring((DATE_BASE+i*DATE_INCR) * 1000000L, pool)
34 #print date
35 fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_DATE, date, pool)
36 fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_AUTHOR, 'mailer test', pool)
38 def main():
39 if len(sys.argv) != 2:
40 print 'USAGE: %s REPOS' % sys.argv[0]
41 sys.exit(1)
43 core.run_app(tweak_dates, sys.argv[1])
45 if __name__ == '__main__':
46 main()