File: random-commits.py

package info (click to toggle)
subversion 1.5.1dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 41,860 kB
  • ctags: 43,900
  • sloc: ansic: 522,648; python: 64,596; sh: 12,784; ruby: 11,838; cpp: 9,584; java: 8,130; lisp: 7,131; perl: 5,686; makefile: 895; xml: 759
file content (30 lines) | stat: -rwxr-xr-x 899 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
#
# USAGE: random-commits.py
#
# Using the FILELIST (see config below), a series of COUNT commits will be
# constructed, each changing up to MAXFILES files per commit. The commands
# will be sent to stdout (formatted as a shell script).
#
# The FILELIST can be constructed using the find-textfiles script.
#

import random

FILELIST = 'textfiles'
COUNT = 1000	# this many commits
MAXFILES = 10	# up to 10 files at a time

files = open(FILELIST).readlines()

print '#!/bin/sh'

for i in range(COUNT):
    n = random.randrange(1, MAXFILES+1)
    l = [ ]
    print "echo '--- begin commit #%d -----------------------------------'" % (i+1,)
    for j in range(n):
        fname = random.choice(files)[:-1]	# strip trailing newline
        print "echo 'part of change #%d' >> %s" % (i+1, fname)
        l.append(fname)
    print "svn commit -m 'commit #%d' %s" % (i+1, ' '.join(l))