File: revlist.py

package info (click to toggle)
ghostscript 10.05.1~dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 93,508 kB
  • sloc: ansic: 908,895; python: 7,676; cpp: 6,534; cs: 6,457; sh: 6,168; java: 4,028; perl: 2,373; tcl: 1,639; makefile: 529; awk: 66; yacc: 18
file content (74 lines) | stat: -rwxr-xr-x 2,068 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python

# script to parse svn log outputs from ghostpcl and gs
# and merge them into a single list for time-based reference
# run from the top level of the ghostpcl source tree

# may be brittle as it's based on parsing human-readable output.

import os, string
import sys

SVN_CMD = 'svn log -q'
SVN_GS_REPOS = 'svn+ssh://svn.ghostscript.com/svn/ghostscript/trunk/gs'
SVN_PCL_REPOS = 'svn+ssh://svn.ghostscript.com/var/lib/svn-private/ghostpcl'

def parse(log, entries, module=None):
  '''parse the output of SVN_CMD and dump the results
     as tuples   in the entries global'''
  if not module: module = ''
  for line in log.readlines():
    if line[0] != 'r': continue
    fields = line.split('|')
    fields = map(string.strip, fields)
    rev = fields[0][1:] # strip the initial 'r'
    author = fields[1]
    date = fields[2]
    entries.append((date, rev, author, module))

def report(entries):
  'print out the results'

  # Every ghostscript revision creates a ghostpcl revision as
  # well, during the period we've had an svn:external for it
  last_gs_rev = 0
  last_pcl_rev = 0

  tab = reduce(max, [len(entry[1]) for entry in entries])

  for entry in entries:
    date = entry[0]
    rev = entry[1]
    author = entry[2]
    module = entry[3]
    if module == 'ghostscript':
      last_gs_rev = int(rev)
      if last_pcl_rev >= 2609:
        rev = str(last_pcl_rev) + '+' + rev
      else:
        continue
    elif module == 'ghostpcl':
      last_pcl_rev = int(rev)
      if last_pcl_rev >= 2609:
        rev = rev + '+' + str(last_gs_rev)
    pad = tab - len(rev)
    print rev, ' ' * pad, date, author
    
if __name__ == '__main__':
  sys.stderr.write('Downloading logs. This may take a while...\n')

  # array to hold the revision data
  entries = []

  log = os.popen(SVN_CMD + ' ' + SVN_PCL_REPOS)
  parse(log, entries, 'ghostpcl')
  log.close()

  log = os.popen(SVN_CMD + ' ' + SVN_GS_REPOS)
  parse(log, entries, 'ghostscript')
  log.close()

  # sort (by date, since that element is first)
  entries.sort()

  report(entries)