Mercurial > hg
annotate hgext/convert/cvsps @ 7614:f9fcb189c8e2
mq: make qnew patch format consistent with qrefresh (issue1457)
author | Bernhard Leiner <bleiner@gmail.com> |
---|---|
date | Mon, 12 Jan 2009 09:12:35 +0100 |
parents | d2ac53fe216e |
children |
rev | line source |
---|---|
6689
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
2 # |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
3 # Commandline front-end for cvsps.py |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
4 # |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
5 # Copyright 2008, Frank Kingswood <frank@kingswood-consulting.co.uk> |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
6 # |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
7 # This software may be used and distributed according to the terms |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
8 # of the GNU General Public License, incorporated herein by reference. |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
9 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
10 import sys |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
11 from mercurial import util |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
12 from mercurial.i18n import _ |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
13 from optparse import OptionParser, SUPPRESS_HELP |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
14 from hgext.convert.cvsps import createlog, createchangeset, logerror |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
15 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
16 def main(): |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
17 '''Main program to mimic cvsps.''' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
18 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
19 op = OptionParser(usage='%prog [-bpruvxz] path', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
20 description='Read CVS rlog for current directory or named ' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
21 'path in repository, and convert the log to changesets ' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
22 'based on matching commit log entries and dates.') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
23 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
24 # Options that are ignored for compatibility with cvsps-2.1 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
25 op.add_option('-A', dest='Ignore', action='store_true', help=SUPPRESS_HELP) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
26 op.add_option('--cvs-direct', dest='Ignore', action='store_true', help=SUPPRESS_HELP) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
27 op.add_option('-q', dest='Ignore', action='store_true', help=SUPPRESS_HELP) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
28 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
29 # Main options shared with cvsps-2.1 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
30 op.add_option('-b', dest='Branches', action='append', default=[], |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
31 help='Only return changes on specified branches') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
32 op.add_option('-p', dest='Prefix', action='store', default='', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
33 help='Prefix to remove from file names') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
34 op.add_option('-r', dest='Revisions', action='append', default=[], |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
35 help='Only return changes after or between specified tags') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
36 op.add_option('-u', dest='Cache', action='store_const', const='update', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
37 help="Update cvs log cache") |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
38 op.add_option('-v', dest='Verbose', action='count', default=0, |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
39 help='Be verbose') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
40 op.add_option('-x', dest='Cache', action='store_const', const='write', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
41 help="Create new cvs log cache") |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
42 op.add_option('-z', dest='Fuzz', action='store', type='int', default=60, |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
43 help='Set commit time fuzz', metavar='seconds') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
44 op.add_option('--root', dest='Root', action='store', default='', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
45 help='Specify cvsroot', metavar='cvsroot') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
46 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
47 # Options specific to this version |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
48 op.add_option('--parents', dest='Parents', action='store_true', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
49 help='Show parent changesets') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
50 op.add_option('--ancestors', dest='Ancestors', action='store_true', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
51 help='Show current changeset in ancestor branches') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
52 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
53 options, args = op.parse_args() |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
54 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
55 # Create a ui object for printing progress messages |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
56 class UI: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
57 def __init__(self, verbose): |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
58 if verbose: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
59 self.status = self.message |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
60 if verbose>1: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
61 self.note = self.message |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
62 if verbose>2: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
63 self.debug = self.message |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
64 def message(self, msg): |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
65 sys.stderr.write(msg) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
66 def nomessage(self, msg): |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
67 pass |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
68 status = nomessage |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
69 note = nomessage |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
70 debug = nomessage |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
71 ui = UI(options.Verbose) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
72 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
73 try: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
74 if args: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
75 log = [] |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
76 for d in args: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
77 log += createlog(ui, d, root=options.Root, cache=options.Cache) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
78 else: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
79 log = createlog(ui, root=options.Root, cache=options.Cache) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
80 except logerror, e: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
81 print e |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
82 return |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
83 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
84 changesets = createchangeset(ui, log, options.Fuzz) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
85 del log |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
86 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
87 # Print changesets (optionally filtered) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
88 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
89 off = len(options.Revisions) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
90 branches = {} # latest version number in each branch |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
91 ancestors = {} # parent branch |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
92 for cs in changesets: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
93 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
94 if options.Ancestors: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
95 if cs.branch not in branches and cs.parents and cs.parents[0].id: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
96 ancestors[cs.branch] = changesets[cs.parents[0].id-1].branch, cs.parents[0].id |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
97 branches[cs.branch] = cs.id |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
98 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
99 # limit by branches |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
100 if options.Branches and (cs.branch or 'HEAD') not in options.Branches: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
101 continue |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
102 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
103 if not off: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
104 # Note: trailing spaces on several lines here are needed to have |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
105 # bug-for-bug compatibility with cvsps. |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
106 print '---------------------' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
107 print 'PatchSet %d ' % cs.id |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
108 print 'Date: %s' % util.datestr(cs.date, '%Y/%m/%d %H:%M:%S %1%2') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
109 print 'Author: %s' % cs.author |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
110 print 'Branch: %s' % (cs.branch or 'HEAD') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
111 print 'Tag%s: %s ' % (['', 's'][len(cs.tags)>1], |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
112 ','.join(cs.tags) or '(none)') |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
113 if options.Parents and cs.parents: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
114 if len(cs.parents)>1: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
115 print 'Parents: %s' % (','.join([str(p.id) for p in cs.parents])) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
116 else: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
117 print 'Parent: %d' % cs.parents[0].id |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
118 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
119 if options.Ancestors: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
120 b = cs.branch |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
121 r = [] |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
122 while b: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
123 b, c = ancestors[b] |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
124 r.append('%s:%d:%d' % (b or "HEAD", c, branches[b])) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
125 if r: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
126 print 'Ancestors: %s' % (','.join(r)) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
127 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
128 print 'Log:' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
129 print cs.comment |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
130 print |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
131 print 'Members: ' |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
132 for f in cs.entries: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
133 fn = f.file |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
134 if fn.startswith(options.Prefix): |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
135 fn = fn[len(options.Prefix):] |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
136 print '\t%s:%s->%s%s ' % (fn, '.'.join([str(x) for x in f.parent]) or 'INITIAL', |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
137 '.'.join([str(x) for x in f.revision]), ['', '(DEAD)'][f.dead]) |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
138 print |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
139 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
140 # have we seen the start tag? |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
141 if options.Revisions and off: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
142 if options.Revisions[0] == str(cs.id) or \ |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
143 options.Revisions[0] in cs.tags: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
144 off = False |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
145 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
146 # see if we reached the end tag |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
147 if len(options.Revisions)>1 and not off: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
148 if options.Revisions[1] == str(cs.id) or \ |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
149 options.Revisions[1] in cs.tags: |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
150 break |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
151 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
152 |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
153 if __name__ == '__main__': |
d2ac53fe216e
convert: cvsps - User interface to CVS changeset code in cvsps.py
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
154 main() |