Mercurial > hg
annotate hgext/convert/cvsps.py @ 17551:a7b3fdaf768d
bookmark: take successors into account when updating (issue3561)
When we rewrite a bookmarked changeset, we want to update the
bookmark on its successors. But the successors are not descendants
of its precursor (by definition). This changeset alters the bookmarks
logic to update bookmark location if the newer location is a successor
of the old one[1].
note: valid destinations are in fact any kind of successors of any kind
of descendants (recursively.)
This changeset requires the enabling of the obsolete feature in
some bookmark tests.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Sun, 26 Aug 2012 01:28:22 +0200 |
parents | e7cfe3587ea4 |
children | a08775ec89f2 |
rev | line source |
---|---|
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
1 # Mercurial built-in replacement for cvsps. |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
2 # |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
3 # Copyright 2008, Frank Kingswood <frank@kingswood-consulting.co.uk> |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
4 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8209
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
10263 | 6 # GNU General Public License version 2 or any later version. |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
7 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
8 import os |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
9 import re |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
10 import cPickle as pickle |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
11 from mercurial import util |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
12 from mercurial.i18n import _ |
10095
69ce7a10e593
convert: implement two hooks in builtin cvsps
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
9467
diff
changeset
|
13 from mercurial import hook |
14945
11aad09a6370
hgext: replace uses of hasattr with util.safehasattr
Augie Fackler <durin42@gmail.com>
parents:
11122
diff
changeset
|
14 from mercurial import util |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
15 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
16 class logentry(object): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
17 '''Class logentry has the following attributes: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
18 .author - author name as CVS knows it |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
19 .branch - name of branch this revision is on |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
20 .branches - revision tuple of branches starting at this revision |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
21 .comment - commit message |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
22 .date - the commit date as a (time, tz) tuple |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
23 .dead - true if file revision is dead |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
24 .file - Name of file |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
25 .lines - a tuple (+lines, -lines) or None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
26 .parent - Previous revision of this entry |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
27 .rcs - name of file as returned from CVS |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
28 .revision - revision number as tuple |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
29 .tags - list of tags on the file |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
30 .synthetic - is this a synthetic "file ... added on ..." revision? |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
31 .mergepoint- the branch that has been merged from |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
32 (if present in rlog output) |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
33 .branchpoints- the branches that start at the current entry |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
34 ''' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
35 def __init__(self, **entries): |
10701
35893dcfd40c
cvsps: fix traceback involving 'synthetic'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10695
diff
changeset
|
36 self.synthetic = False |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
37 self.__dict__.update(entries) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
38 |
8080
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
39 def __repr__(self): |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
40 return "<%s at 0x%x: %s %s>" % (self.__class__.__name__, |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
41 id(self), |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
42 self.file, |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
43 ".".join(map(str, self.revision))) |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
44 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
45 class logerror(Exception): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
46 pass |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
47 |
7097
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
48 def getrepopath(cvspath): |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
49 """Return the repository path from a CVS path. |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
50 |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
51 >>> getrepopath('/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
52 '/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
53 >>> getrepopath('c:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
54 'c:/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
55 >>> getrepopath(':pserver:10/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
56 '/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
57 >>> getrepopath(':pserver:10c:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
58 '/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
59 >>> getrepopath(':pserver:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
60 '/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
61 >>> getrepopath(':pserver:c:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
62 'c:/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
63 >>> getrepopath(':pserver:truc@foo.bar:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
64 '/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
65 >>> getrepopath(':pserver:truc@foo.bar:c:/foo/bar') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
66 'c:/foo/bar' |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
67 """ |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
68 # According to CVS manual, CVS paths are expressed like: |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
69 # [:method:][[user][:password]@]hostname[:[port]]/path/to/repository |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
70 # |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
71 # Unfortunately, Windows absolute paths start with a drive letter |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
72 # like 'c:' making it harder to parse. Here we assume that drive |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
73 # letters are only one character long and any CVS component before |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
74 # the repository path is at least 2 characters long, and use this |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
75 # to disambiguate. |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
76 parts = cvspath.split(':') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
77 if len(parts) == 1: |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
78 return parts[0] |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
79 # Here there is an ambiguous case if we have a port number |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
80 # immediately followed by a Windows driver letter. We assume this |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
81 # never happens and decide it must be CVS path component, |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
82 # therefore ignoring it. |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
83 if len(parts[-2]) > 1: |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
84 return parts[-1].lstrip('0123456789') |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
85 return parts[-2] + ':' + parts[-1] |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
86 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
87 def createlog(ui, directory=None, root="", rlog=True, cache=None): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
88 '''Collect the CVS rlog''' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
89 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
90 # Because we store many duplicate commit log messages, reusing strings |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
91 # saves a lot of memory and pickle storage space. |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
92 _scache = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
93 def scache(s): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
94 "return a shared version of a string" |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
95 return _scache.setdefault(s, s) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
96 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
97 ui.status(_('collecting CVS rlog\n')) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
98 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
99 log = [] # list of logentry objects containing the CVS state |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
100 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
101 # patterns to match in CVS (r)log output, by state of use |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
102 re_00 = re.compile('RCS file: (.+)$') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
103 re_01 = re.compile('cvs \\[r?log aborted\\]: (.+)$') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
104 re_02 = re.compile('cvs (r?log|server): (.+)\n$') |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
105 re_03 = re.compile("(Cannot access.+CVSROOT)|" |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
106 "(can't create temporary directory.+)$") |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
107 re_10 = re.compile('Working file: (.+)$') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
108 re_20 = re.compile('symbolic names:') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
109 re_30 = re.compile('\t(.+): ([\\d.]+)$') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
110 re_31 = re.compile('----------------------------$') |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
111 re_32 = re.compile('=======================================' |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
112 '======================================$') |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
113 re_50 = re.compile('revision ([\\d.]+)(\s+locked by:\s+.+;)?$') |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
114 re_60 = re.compile(r'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);' |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
115 r'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?' |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
116 r'(.*mergepoint:\s+([^;]+);)?') |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
117 re_70 = re.compile('branches: (.+);$') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
118 |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
119 file_added_re = re.compile(r'file [^/]+ was (initially )?added on branch') |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
120 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
121 prefix = '' # leading path to strip of what we get from CVS |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
122 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
123 if directory is None: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
124 # Current working directory |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
125 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
126 # Get the real directory in the repository |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
127 try: |
9031
3b76321aa0de
compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents:
8890
diff
changeset
|
128 prefix = open(os.path.join('CVS','Repository')).read().strip() |
10695
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
129 directory = prefix |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
130 if prefix == ".": |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
131 prefix = "" |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
132 except IOError: |
10939
9f6731b03906
convert: mark strings for translation
Martin Geisler <mg@lazybytes.net>
parents:
10701
diff
changeset
|
133 raise logerror(_('not a CVS sandbox')) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
134 |
7097
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
135 if prefix and not prefix.endswith(os.sep): |
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
136 prefix += os.sep |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
137 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
138 # Use the Root file in the sandbox, if it exists |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
139 try: |
9031
3b76321aa0de
compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents:
8890
diff
changeset
|
140 root = open(os.path.join('CVS','Root')).read().strip() |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
141 except IOError: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
142 pass |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
143 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
144 if not root: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
145 root = os.environ.get('CVSROOT', '') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
146 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
147 # read log cache if one exists |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
148 oldlog = [] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
149 date = None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
150 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
151 if cache: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
152 cachedir = os.path.expanduser('~/.hg.cvsps') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
153 if not os.path.exists(cachedir): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
154 os.mkdir(cachedir) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
155 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
156 # The cvsps cache pickle needs a uniquified name, based on the |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
157 # repository location. The address may have all sort of nasties |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
158 # in it, slashes, colons and such. So here we take just the |
17424
e7cfe3587ea4
fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents:
16688
diff
changeset
|
159 # alphanumeric characters, concatenated in a way that does not |
e7cfe3587ea4
fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents:
16688
diff
changeset
|
160 # mix up the various components, so that |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
161 # :pserver:user@server:/path |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
162 # and |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
163 # /pserver/user/server/path |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
164 # are mapped to different cache file names. |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
165 cachefile = root.split(":") + [directory, "cache"] |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
166 cachefile = ['-'.join(re.findall(r'\w+', s)) for s in cachefile if s] |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
167 cachefile = os.path.join(cachedir, |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
168 '.'.join([s for s in cachefile if s])) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
169 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
170 if cache == 'update': |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
171 try: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
172 ui.note(_('reading cvs log cache %s\n') % cachefile) |
9031
3b76321aa0de
compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents:
8890
diff
changeset
|
173 oldlog = pickle.load(open(cachefile)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
174 ui.note(_('cache has %d log entries\n') % len(oldlog)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
175 except Exception, e: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
176 ui.note(_('error reading cache: %r\n') % e) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
177 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
178 if oldlog: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
179 date = oldlog[-1].date # last commit date as a (time,tz) tuple |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
180 date = util.datestr(date, '%Y/%m/%d %H:%M:%S %1%2') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
181 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
182 # build the CVS commandline |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
183 cmd = ['cvs', '-q'] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
184 if root: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
185 cmd.append('-d%s' % root) |
7097
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
186 p = util.normpath(getrepopath(root)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
187 if not p.endswith('/'): |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
188 p += '/' |
10695
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
189 if prefix: |
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
190 # looks like normpath replaces "" by "." |
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
191 prefix = p + util.normpath(prefix) |
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
192 else: |
b4b16e90712f
convert: teach cvsps to handle . repository (issue1649)
Mathieu Clabaut <mathieu.clabaut@systerel.fr>
parents:
10282
diff
changeset
|
193 prefix = p |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
194 cmd.append(['log', 'rlog'][rlog]) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
195 if date: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
196 # no space between option and date string |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
197 cmd.append('-d>%s' % date) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
198 cmd.append(directory) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
199 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
200 # state machine begins here |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
201 tags = {} # dictionary of revisions on current file with their tags |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
202 branchmap = {} # mapping between branch names and revision numbers |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
203 state = 0 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
204 store = False # set when a new record can be appended |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
205 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
206 cmd = [util.shellquote(arg) for arg in cmd] |
6956
12472a240398
i18n: mark strings for translation in convert extension
Martin Geisler <mg@daimi.au.dk>
parents:
6762
diff
changeset
|
207 ui.note(_("running %s\n") % (' '.join(cmd))) |
9467
4c041f1ee1b4
do not attempt to translate ui.debug output
Martin Geisler <mg@lazybytes.net>
parents:
9032
diff
changeset
|
208 ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
209 |
7593
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
210 pfp = util.popen(' '.join(cmd)) |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
211 peek = pfp.readline() |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
212 while True: |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
213 line = peek |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
214 if line == '': |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
215 break |
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
216 peek = pfp.readline() |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
217 if line.endswith('\n'): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
218 line = line[:-1] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
219 #ui.debug('state=%d line=%r\n' % (state, line)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
220 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
221 if state == 0: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
222 # initial state, consume input until we see 'RCS file' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
223 match = re_00.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
224 if match: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
225 rcs = match.group(1) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
226 tags = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
227 if rlog: |
7097
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
228 filename = util.normpath(rcs[:-2]) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
229 if filename.startswith(prefix): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
230 filename = filename[len(prefix):] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
231 if filename.startswith('/'): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
232 filename = filename[1:] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
233 if filename.startswith('Attic/'): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
234 filename = filename[6:] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
235 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
236 filename = filename.replace('/Attic/', '/') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
237 state = 2 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
238 continue |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
239 state = 1 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
240 continue |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
241 match = re_01.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
242 if match: |
11122
2114e44b08f6
clean up remaining generic exceptions
Matt Mackall <mpm@selenic.com>
parents:
10950
diff
changeset
|
243 raise logerror(match.group(1)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
244 match = re_02.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
245 if match: |
11122
2114e44b08f6
clean up remaining generic exceptions
Matt Mackall <mpm@selenic.com>
parents:
10950
diff
changeset
|
246 raise logerror(match.group(2)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
247 if re_03.match(line): |
11122
2114e44b08f6
clean up remaining generic exceptions
Matt Mackall <mpm@selenic.com>
parents:
10950
diff
changeset
|
248 raise logerror(line) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
249 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
250 elif state == 1: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
251 # expect 'Working file' (only when using log instead of rlog) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
252 match = re_10.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
253 assert match, _('RCS file must be followed by working file') |
7097
d4218edd55bd
convert: fix builtin cvsps under Windows
Patrick Mezard <pmezard@gmail.com>
parents:
6956
diff
changeset
|
254 filename = util.normpath(match.group(1)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
255 state = 2 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
256 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
257 elif state == 2: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
258 # expect 'symbolic names' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
259 if re_20.match(line): |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
260 branchmap = {} |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
261 state = 3 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
262 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
263 elif state == 3: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
264 # read the symbolic names and store as tags |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
265 match = re_30.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
266 if match: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
267 rev = [int(x) for x in match.group(2).split('.')] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
268 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
269 # Convert magic branch number to an odd-numbered one |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
270 revn = len(rev) |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
271 if revn > 3 and (revn % 2) == 0 and rev[-2] == 0: |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
272 rev = rev[:-2] + rev[-1:] |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
273 rev = tuple(rev) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
274 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
275 if rev not in tags: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
276 tags[rev] = [] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
277 tags[rev].append(match.group(1)) |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
278 branchmap[match.group(1)] = match.group(2) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
279 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
280 elif re_31.match(line): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
281 state = 5 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
282 elif re_32.match(line): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
283 state = 0 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
284 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
285 elif state == 4: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
286 # expecting '------' separator before first revision |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
287 if re_31.match(line): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
288 state = 5 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
289 else: |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
290 assert not re_32.match(line), _('must have at least ' |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
291 'some revisions') |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
292 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
293 elif state == 5: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
294 # expecting revision number and possibly (ignored) lock indication |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
295 # we create the logentry here from values stored in states 0 to 4, |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
296 # as this state is re-entered for subsequent revisions of a file. |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
297 match = re_50.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
298 assert match, _('expected revision number') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
299 e = logentry(rcs=scache(rcs), file=scache(filename), |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
300 revision=tuple([int(x) for x in match.group(1).split('.')]), |
10701
35893dcfd40c
cvsps: fix traceback involving 'synthetic'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10695
diff
changeset
|
301 branches=[], parent=None) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
302 state = 6 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
303 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
304 elif state == 6: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
305 # expecting date, author, state, lines changed |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
306 match = re_60.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
307 assert match, _('revision must be followed by date line') |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
308 d = match.group(1) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
309 if d[2] == '/': |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
310 # Y2K |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
311 d = '19' + d |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
312 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
313 if len(d.split()) != 3: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
314 # cvs log dates always in GMT |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
315 d = d + ' UTC' |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
316 e.date = util.parsedate(d, ['%y/%m/%d %H:%M:%S', |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
317 '%Y/%m/%d %H:%M:%S', |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
318 '%Y-%m-%d %H:%M:%S']) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
319 e.author = scache(match.group(2)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
320 e.dead = match.group(3).lower() == 'dead' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
321 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
322 if match.group(5): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
323 if match.group(6): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
324 e.lines = (int(match.group(5)), int(match.group(6))) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
325 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
326 e.lines = (int(match.group(5)), 0) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
327 elif match.group(6): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
328 e.lines = (0, int(match.group(6))) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
329 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
330 e.lines = None |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
331 |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
332 if match.group(7): # cvsnt mergepoint |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
333 myrev = match.group(8).split('.') |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
334 if len(myrev) == 2: # head |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
335 e.mergepoint = 'HEAD' |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
336 else: |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
337 myrev = '.'.join(myrev[:-2] + ['0', myrev[-2]]) |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
338 branches = [b for b in branchmap if branchmap[b] == myrev] |
16683 | 339 assert len(branches) == 1, ('unknown branch: %s' |
340 % e.mergepoint) | |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
341 e.mergepoint = branches[0] |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
342 else: |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
343 e.mergepoint = None |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
344 e.comment = [] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
345 state = 7 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
346 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
347 elif state == 7: |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
348 # read the revision numbers of branches that start at this revision |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
349 # or store the commit log message otherwise |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
350 m = re_70.match(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
351 if m: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
352 e.branches = [tuple([int(y) for y in x.strip().split('.')]) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
353 for x in m.group(1).split(';')] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
354 state = 8 |
7593
9811cc670c51
cvsps: cvs log loop uses lookahead to avoid misleading text
David Champion <dgc@uchicago.edu>
parents:
7573
diff
changeset
|
355 elif re_31.match(line) and re_50.match(peek): |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
356 state = 5 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
357 store = True |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
358 elif re_32.match(line): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
359 state = 0 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
360 store = True |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
361 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
362 e.comment.append(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
363 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
364 elif state == 8: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
365 # store commit log message |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
366 if re_31.match(line): |
15205
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
367 cpeek = peek |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
368 if cpeek.endswith('\n'): |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
369 cpeek = cpeek[:-1] |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
370 if re_50.match(cpeek): |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
371 state = 5 |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
372 store = True |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
373 else: |
4e5b7d130e76
convert: detect false cset boundaries in cvsps descriptions
jakob krainz <jakob@hawo-net.de>
parents:
14945
diff
changeset
|
374 e.comment.append(line) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
375 elif re_32.match(line): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
376 state = 0 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
377 store = True |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
378 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
379 e.comment.append(line) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
380 |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
381 # When a file is added on a branch B1, CVS creates a synthetic |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
382 # dead trunk revision 1.1 so that the branch has a root. |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
383 # Likewise, if you merge such a file to a later branch B2 (one |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
384 # that already existed when the file was added on B1), CVS |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
385 # creates a synthetic dead revision 1.1.x.1 on B2. Don't drop |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
386 # these revisions now, but mark them synthetic so |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
387 # createchangeset() can take care of them. |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
388 if (store and |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
389 e.dead and |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
390 e.revision[-1] == 1 and # 1.1 or 1.1.x.1 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
391 len(e.comment) == 1 and |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
392 file_added_re.match(e.comment[0])): |
9467
4c041f1ee1b4
do not attempt to translate ui.debug output
Martin Geisler <mg@lazybytes.net>
parents:
9032
diff
changeset
|
393 ui.debug('found synthetic revision in %s: %r\n' |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
394 % (e.rcs, e.comment[0])) |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
395 e.synthetic = True |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
396 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
397 if store: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
398 # clean up the results and save in the log. |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
399 store = False |
8209
a1a5a57efe90
replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents:
8171
diff
changeset
|
400 e.tags = sorted([scache(x) for x in tags.get(e.revision, [])]) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
401 e.comment = scache('\n'.join(e.comment)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
402 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
403 revn = len(e.revision) |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
404 if revn > 3 and (revn % 2) == 0: |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
405 e.branch = tags.get(e.revision[:-1], [None])[0] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
406 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
407 e.branch = None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
408 |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
409 # find the branches starting from this revision |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
410 branchpoints = set() |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
411 for branch, revision in branchmap.iteritems(): |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
412 revparts = tuple([int(i) for i in revision.split('.')]) |
10950 | 413 if len(revparts) < 2: # bad tags |
414 continue | |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
415 if revparts[-2] == 0 and revparts[-1] % 2 == 0: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
416 # normal branch |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
417 if revparts[:-2] == e.revision: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
418 branchpoints.add(branch) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
419 elif revparts == (1, 1, 1): # vendor branch |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
420 if revparts in e.branches: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
421 branchpoints.add(branch) |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
422 e.branchpoints = branchpoints |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
423 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
424 log.append(e) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
425 |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
426 if len(log) % 100 == 0: |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
427 ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n') |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
428 |
9032
1fa80c5428b8
compat: use 'key' argument instead of 'cmp' when sorting a list
Alejandro Santos <alejolp@alejolp.com>
parents:
9031
diff
changeset
|
429 log.sort(key=lambda x: (x.rcs, x.revision)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
430 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
431 # find parent revisions of individual files |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
432 versions = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
433 for e in log: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
434 branch = e.revision[:-1] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
435 p = versions.get((e.rcs, branch), None) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
436 if p is None: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
437 p = e.revision[:-2] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
438 e.parent = p |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
439 versions[(e.rcs, branch)] = e.revision |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
440 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
441 # update the log cache |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
442 if cache: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
443 if log: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
444 # join up the old and new logs |
9032
1fa80c5428b8
compat: use 'key' argument instead of 'cmp' when sorting a list
Alejandro Santos <alejolp@alejolp.com>
parents:
9031
diff
changeset
|
445 log.sort(key=lambda x: x.date) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
446 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
447 if oldlog and oldlog[-1].date >= log[0].date: |
10939
9f6731b03906
convert: mark strings for translation
Martin Geisler <mg@lazybytes.net>
parents:
10701
diff
changeset
|
448 raise logerror(_('log cache overlaps with new log entries,' |
9f6731b03906
convert: mark strings for translation
Martin Geisler <mg@lazybytes.net>
parents:
10701
diff
changeset
|
449 ' re-run without cache.')) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
450 |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
451 log = oldlog + log |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
452 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
453 # write the new cachefile |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
454 ui.note(_('writing cvs log cache %s\n') % cachefile) |
9031
3b76321aa0de
compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents:
8890
diff
changeset
|
455 pickle.dump(log, open(cachefile, 'w')) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
456 else: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
457 log = oldlog |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
458 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
459 ui.status(_('%d log entries\n') % len(log)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
460 |
10095
69ce7a10e593
convert: implement two hooks in builtin cvsps
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
9467
diff
changeset
|
461 hook.hook(ui, None, "cvslog", True, log=log) |
69ce7a10e593
convert: implement two hooks in builtin cvsps
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
9467
diff
changeset
|
462 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
463 return log |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
464 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
465 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
466 class changeset(object): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
467 '''Class changeset has the following attributes: |
8079
fb162c47000b
cvsps: update docstring for changeset class.
Greg Ward <greg-hg@gerg.ca>
parents:
8028
diff
changeset
|
468 .id - integer identifying this changeset (list index) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
469 .author - author name as CVS knows it |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
470 .branch - name of branch this changeset is on, or None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
471 .comment - commit message |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
472 .date - the commit date as a (time,tz) tuple |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
473 .entries - list of logentry objects in this changeset |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
474 .parents - list of one or two parent changesets |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
475 .tags - list of tags on this changeset |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
476 .synthetic - from synthetic revision "file ... added on branch ..." |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
477 .mergepoint- the branch that has been merged from |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
478 (if present in rlog output) |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
479 .branchpoints- the branches that start at the current entry |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
480 ''' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
481 def __init__(self, **entries): |
10701
35893dcfd40c
cvsps: fix traceback involving 'synthetic'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10695
diff
changeset
|
482 self.synthetic = False |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
483 self.__dict__.update(entries) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
484 |
8080
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
485 def __repr__(self): |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
486 return "<%s at 0x%x: %s>" % (self.__class__.__name__, |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
487 id(self), |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
488 getattr(self, 'id', "(no id)")) |
19229b0b292d
cvsps: make debugging easier by adding __repr__() methods.
Greg Ward <greg-hg@gerg.ca>
parents:
8079
diff
changeset
|
489 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
490 def createchangeset(ui, log, fuzz=60, mergefrom=None, mergeto=None): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
491 '''Convert log into changesets.''' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
492 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
493 ui.status(_('creating changesets\n')) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
494 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
495 # Merge changesets |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
496 |
9032
1fa80c5428b8
compat: use 'key' argument instead of 'cmp' when sorting a list
Alejandro Santos <alejolp@alejolp.com>
parents:
9031
diff
changeset
|
497 log.sort(key=lambda x: (x.comment, x.author, x.branch, x.date)) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
498 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
499 changesets = [] |
8456
e9e2a2c9b294
convert: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8225
diff
changeset
|
500 files = set() |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
501 c = None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
502 for i, e in enumerate(log): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
503 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
504 # Check if log entry belongs to the current changeset or not. |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
505 |
17424
e7cfe3587ea4
fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents:
16688
diff
changeset
|
506 # Since CVS is file-centric, two different file revisions with |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
507 # different branchpoints should be treated as belonging to two |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
508 # different changesets (and the ordering is important and not |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
509 # honoured by cvsps at this point). |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
510 # |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
511 # Consider the following case: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
512 # foo 1.1 branchpoints: [MYBRANCH] |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
513 # bar 1.1 branchpoints: [MYBRANCH, MYBRANCH2] |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
514 # |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
515 # Here foo is part only of MYBRANCH, but not MYBRANCH2, e.g. a |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
516 # later version of foo may be in MYBRANCH2, so foo should be the |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
517 # first changeset and bar the next and MYBRANCH and MYBRANCH2 |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
518 # should both start off of the bar changeset. No provisions are |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
519 # made to ensure that this is, in fact, what happens. |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
520 if not (c and |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
521 e.comment == c.comment and |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
522 e.author == c.author and |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
523 e.branch == c.branch and |
14945
11aad09a6370
hgext: replace uses of hasattr with util.safehasattr
Augie Fackler <durin42@gmail.com>
parents:
11122
diff
changeset
|
524 (not util.safehasattr(e, 'branchpoints') or |
11aad09a6370
hgext: replace uses of hasattr with util.safehasattr
Augie Fackler <durin42@gmail.com>
parents:
11122
diff
changeset
|
525 not util.safehasattr (c, 'branchpoints') or |
8890
c487719cccef
convert: fix builtin cvsps when no branchpoints are present
Rocco Rutte <pdmef@gmx.net>
parents:
8756
diff
changeset
|
526 e.branchpoints == c.branchpoints) and |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
527 ((c.date[0] + c.date[1]) <= |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
528 (e.date[0] + e.date[1]) <= |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
529 (c.date[0] + c.date[1]) + fuzz) and |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
530 e.file not in files): |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
531 c = changeset(comment=e.comment, author=e.author, |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
532 branch=e.branch, date=e.date, entries=[], |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
533 mergepoint=getattr(e, 'mergepoint', None), |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
534 branchpoints=getattr(e, 'branchpoints', set())) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
535 changesets.append(c) |
8456
e9e2a2c9b294
convert: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8225
diff
changeset
|
536 files = set() |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
537 if len(changesets) % 100 == 0: |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
538 t = '%d %s' % (len(changesets), repr(e.comment)[1:-1]) |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
539 ui.status(util.ellipsis(t, 80) + '\n') |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
540 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
541 c.entries.append(e) |
8456
e9e2a2c9b294
convert: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8225
diff
changeset
|
542 files.add(e.file) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
543 c.date = e.date # changeset date is date of latest commit in it |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
544 |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
545 # Mark synthetic changesets |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
546 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
547 for c in changesets: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
548 # Synthetic revisions always get their own changeset, because |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
549 # the log message includes the filename. E.g. if you add file3 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
550 # and file4 on a branch, you get four log entries and three |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
551 # changesets: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
552 # "File file3 was added on branch ..." (synthetic, 1 entry) |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
553 # "File file4 was added on branch ..." (synthetic, 1 entry) |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
554 # "Add file3 and file4 to fix ..." (real, 2 entries) |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
555 # Hence the check for 1 entry here. |
10701
35893dcfd40c
cvsps: fix traceback involving 'synthetic'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10695
diff
changeset
|
556 c.synthetic = len(c.entries) == 1 and c.entries[0].synthetic |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
557 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
558 # Sort files in each changeset |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
559 |
15790
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
560 def entitycompare(l, r): |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
561 'Mimic cvsps sorting order' |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
562 l = l.file.split('/') |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
563 r = r.file.split('/') |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
564 nl = len(l) |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
565 nr = len(r) |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
566 n = min(nl, nr) |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
567 for i in range(n): |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
568 if i + 1 == nl and nl < nr: |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
569 return -1 |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
570 elif i + 1 == nr and nl > nr: |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
571 return +1 |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
572 elif l[i] < r[i]: |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
573 return -1 |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
574 elif l[i] > r[i]: |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
575 return +1 |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
576 return 0 |
52f816b40674
cvsps: pull function definition out of loop
Martin Geisler <mg@aragost.com>
parents:
15205
diff
changeset
|
577 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
578 for c in changesets: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
579 c.entries.sort(entitycompare) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
580 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
581 # Sort changesets by date |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
582 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
583 def cscmp(l, r): |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
584 d = sum(l.date) - sum(r.date) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
585 if d: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
586 return d |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
587 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
588 # detect vendor branches and initial commits on a branch |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
589 le = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
590 for e in l.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
591 le[e.rcs] = e.revision |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
592 re = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
593 for e in r.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
594 re[e.rcs] = e.revision |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
595 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
596 d = 0 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
597 for e in l.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
598 if re.get(e.rcs, None) == e.parent: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
599 assert not d |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
600 d = 1 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
601 break |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
602 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
603 for e in r.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
604 if le.get(e.rcs, None) == e.parent: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
605 assert not d |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
606 d = -1 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
607 break |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
608 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
609 return d |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
610 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
611 changesets.sort(cscmp) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
612 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
613 # Collect tags |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
614 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
615 globaltags = {} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
616 for c in changesets: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
617 for e in c.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
618 for tag in e.tags: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
619 # remember which is the latest changeset to have this tag |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
620 globaltags[tag] = c |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
621 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
622 for c in changesets: |
8456
e9e2a2c9b294
convert: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8225
diff
changeset
|
623 tags = set() |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
624 for e in c.entries: |
8483
221786b9ce34
convert/cvsps: use set.update for bulk update
Martin Geisler <mg@lazybytes.net>
parents:
8456
diff
changeset
|
625 tags.update(e.tags) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
626 # remember tags only if this is the latest changeset to have it |
8456
e9e2a2c9b294
convert: use set instead of dict
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8225
diff
changeset
|
627 c.tags = sorted(tag for tag in tags if globaltags[tag] is c) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
628 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
629 # Find parent changesets, handle {{mergetobranch BRANCHNAME}} |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
630 # by inserting dummy changesets with two parents, and handle |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
631 # {{mergefrombranch BRANCHNAME}} by setting two parents. |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
632 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
633 if mergeto is None: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
634 mergeto = r'{{mergetobranch ([-\w]+)}}' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
635 if mergeto: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
636 mergeto = re.compile(mergeto) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
637 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
638 if mergefrom is None: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
639 mergefrom = r'{{mergefrombranch ([-\w]+)}}' |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
640 if mergefrom: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
641 mergefrom = re.compile(mergefrom) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
642 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
643 versions = {} # changeset index where we saw any particular file version |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
644 branches = {} # changeset index where we saw a branch |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
645 n = len(changesets) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
646 i = 0 |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
647 while i < n: |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
648 c = changesets[i] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
649 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
650 for f in c.entries: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
651 versions[(f.rcs, f.revision)] = i |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
652 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
653 p = None |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
654 if c.branch in branches: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
655 p = branches[c.branch] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
656 else: |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
657 # first changeset on a new branch |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
658 # the parent is a changeset with the branch in its |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
659 # branchpoints such that it is the latest possible |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
660 # commit without any intervening, unrelated commits. |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
661 |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
662 for candidate in xrange(i): |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
663 if c.branch not in changesets[candidate].branchpoints: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
664 if p is not None: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
665 break |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
666 continue |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
667 p = candidate |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
668 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
669 c.parents = [] |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
670 if p is not None: |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
671 p = changesets[p] |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
672 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
673 # Ensure no changeset has a synthetic changeset as a parent. |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
674 while p.synthetic: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
675 assert len(p.parents) <= 1, \ |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
676 _('synthetic changeset cannot have multiple parents') |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
677 if p.parents: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
678 p = p.parents[0] |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
679 else: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
680 p = None |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
681 break |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
682 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
683 if p is not None: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
684 c.parents.append(p) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
685 |
7956
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
686 if c.mergepoint: |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
687 if c.mergepoint == 'HEAD': |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
688 c.mergepoint = None |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
689 c.parents.append(changesets[branches[c.mergepoint]]) |
3e7611a83230
convert: added cvsnt mergepoint support
Henrik Stuart <henrik.stuart@edlund.dk>
parents:
7950
diff
changeset
|
690 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
691 if mergefrom: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
692 m = mergefrom.search(c.comment) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
693 if m: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
694 m = m.group(1) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
695 if m == 'HEAD': |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
696 m = None |
8171
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
697 try: |
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
698 candidate = changesets[branches[m]] |
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
699 except KeyError: |
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
700 ui.warn(_("warning: CVS commit message references " |
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
701 "non-existent branch %r:\n%s\n") |
4e5bd9b97bb3
cvsps: fix crash when log message refers to non-existent branch (issue1615).
Greg Ward <greg-hg@gerg.ca>
parents:
8080
diff
changeset
|
702 % (m, c.comment)) |
7950
9bbcfa898cd3
issue1578: fix crash: do not use synthetic changesets as merge parents.
Greg Ward <greg-hg@gerg.ca>
parents:
7862
diff
changeset
|
703 if m in branches and c.branch != m and not candidate.synthetic: |
9bbcfa898cd3
issue1578: fix crash: do not use synthetic changesets as merge parents.
Greg Ward <greg-hg@gerg.ca>
parents:
7862
diff
changeset
|
704 c.parents.append(candidate) |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
705 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
706 if mergeto: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
707 m = mergeto.search(c.comment) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
708 if m: |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
16683
diff
changeset
|
709 if m.groups(): |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
710 m = m.group(1) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
711 if m == 'HEAD': |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
712 m = None |
16688
cfb6682961b8
cleanup: replace naked excepts with more specific ones
Brodie Rao <brodie@sf.io>
parents:
16683
diff
changeset
|
713 else: |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
714 m = None # if no group found then merge to HEAD |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
715 if m in branches and c.branch != m: |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
716 # insert empty changeset for merge |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
717 cc = changeset( |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
718 author=c.author, branch=m, date=c.date, |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
719 comment='convert-repo: CVS merge from branch %s' |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
720 % c.branch, |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
721 entries=[], tags=[], |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
722 parents=[changesets[branches[m]], c]) |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
723 changesets.insert(i + 1, cc) |
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
724 branches[m] = i + 1 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
725 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
726 # adjust our loop counters now we have inserted a new entry |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
727 n += 1 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
728 i += 2 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
729 continue |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
730 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
731 branches[c.branch] = i |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
732 i += 1 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
733 |
7862
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
734 # Drop synthetic changesets (safe now that we have ensured no other |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
735 # changesets can have them as parents). |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
736 i = 0 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
737 while i < len(changesets): |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
738 if changesets[i].synthetic: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
739 del changesets[i] |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
740 else: |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
741 i += 1 |
02981000012e
cvsps: recognize and eliminate CVS' synthetic "file added" revisions.
Greg Ward <greg-hg@gerg.ca>
parents:
7601
diff
changeset
|
742 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
743 # Number changesets |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
744 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
745 for i, c in enumerate(changesets): |
6688
5cd7a8433cd4
cvsps: fix up some whitespace
Matt Mackall <mpm@selenic.com>
parents:
6687
diff
changeset
|
746 c.id = i + 1 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
747 |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
748 ui.status(_('%d changeset entries\n') % len(changesets)) |
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
749 |
10095
69ce7a10e593
convert: implement two hooks in builtin cvsps
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
9467
diff
changeset
|
750 hook.hook(ui, None, "cvschangesets", True, changesets=changesets) |
69ce7a10e593
convert: implement two hooks in builtin cvsps
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
9467
diff
changeset
|
751 |
6687
f8ef39206f6a
convert: cvsps.py - code to generate changesets from a CVS repository
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
diff
changeset
|
752 return changesets |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
753 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
754 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
755 def debugcvsps(ui, *args, **opts): |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
756 '''Read CVS rlog for current directory or named path in |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
757 repository, and convert the log to changesets based on matching |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
758 commit log entries and dates. |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
759 ''' |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
760 if opts["new_cache"]: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
761 cache = "write" |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
762 elif opts["update_cache"]: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
763 cache = "update" |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
764 else: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
765 cache = None |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
766 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
767 revisions = opts["revisions"] |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
768 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
769 try: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
770 if args: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
771 log = [] |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
772 for d in args: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
773 log += createlog(ui, d, root=opts["root"], cache=cache) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
774 else: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
775 log = createlog(ui, root=opts["root"], cache=cache) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
776 except logerror, e: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
777 ui.write("%r\n"%e) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
778 return |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
779 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
780 changesets = createchangeset(ui, log, opts["fuzz"]) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
781 del log |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
782 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
783 # Print changesets (optionally filtered) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
784 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
785 off = len(revisions) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
786 branches = {} # latest version number in each branch |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
787 ancestors = {} # parent branch |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
788 for cs in changesets: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
789 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
790 if opts["ancestors"]: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
791 if cs.branch not in branches and cs.parents and cs.parents[0].id: |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
792 ancestors[cs.branch] = (changesets[cs.parents[0].id - 1].branch, |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
793 cs.parents[0].id) |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
794 branches[cs.branch] = cs.id |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
795 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
796 # limit by branches |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
797 if opts["branches"] and (cs.branch or 'HEAD') not in opts["branches"]: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
798 continue |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
799 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
800 if not off: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
801 # Note: trailing spaces on several lines here are needed to have |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
802 # bug-for-bug compatibility with cvsps. |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
803 ui.write('---------------------\n') |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
804 ui.write('PatchSet %d \n' % cs.id) |
8661
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
805 ui.write('Date: %s\n' % util.datestr(cs.date, |
883f14fcd1df
convert/cvsps: wrap long lines
Martin Geisler <mg@lazybytes.net>
parents:
8483
diff
changeset
|
806 '%Y/%m/%d %H:%M:%S %1%2')) |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
807 ui.write('Author: %s\n' % cs.author) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
808 ui.write('Branch: %s\n' % (cs.branch or 'HEAD')) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
809 ui.write('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1], |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
810 ','.join(cs.tags) or '(none)')) |
8756
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
811 branchpoints = getattr(cs, 'branchpoints', None) |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
812 if branchpoints: |
6019e6517f95
convert: better support for CVS branchpoints (issue1447)
Henrik Stuart <hg@hstuart.dk>
parents:
8661
diff
changeset
|
813 ui.write('Branchpoints: %s \n' % ', '.join(branchpoints)) |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
814 if opts["parents"] and cs.parents: |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
815 if len(cs.parents) > 1: |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
816 ui.write('Parents: %s\n' % |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
817 (','.join([str(p.id) for p in cs.parents]))) |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
818 else: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
819 ui.write('Parent: %d\n' % cs.parents[0].id) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
820 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
821 if opts["ancestors"]: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
822 b = cs.branch |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
823 r = [] |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
824 while b: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
825 b, c = ancestors[b] |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
826 r.append('%s:%d:%d' % (b or "HEAD", c, branches[b])) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
827 if r: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
828 ui.write('Ancestors: %s\n' % (','.join(r))) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
829 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
830 ui.write('Log:\n') |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
831 ui.write('%s\n\n' % cs.comment) |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
832 ui.write('Members: \n') |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
833 for f in cs.entries: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
834 fn = f.file |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
835 if fn.startswith(opts["prefix"]): |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
836 fn = fn[len(opts["prefix"]):] |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
837 ui.write('\t%s:%s->%s%s \n' % ( |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
838 fn, '.'.join([str(x) for x in f.parent]) or 'INITIAL', |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
839 '.'.join([str(x) for x in f.revision]), |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
840 ['', '(DEAD)'][f.dead])) |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
841 ui.write('\n') |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
842 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
843 # have we seen the start tag? |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
844 if revisions and off: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
845 if revisions[0] == str(cs.id) or \ |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
846 revisions[0] in cs.tags: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
847 off = False |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
848 |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
849 # see if we reached the end tag |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10264
diff
changeset
|
850 if len(revisions) > 1 and not off: |
7502
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
851 if revisions[1] == str(cs.id) or \ |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
852 revisions[1] in cs.tags: |
16905fc2690f
Add debugcvsps command, replacing cvsps script
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents:
7280
diff
changeset
|
853 break |