hgext/convert/cvs.py
author Renato Cunha <renatoc@gmail.com>
Sat, 07 Aug 2010 16:38:38 -0300
changeset 11878 8bb1481cf08f
parent 11134 33010ff1fd6f
child 11987 3145951e50fe
permissions -rw-r--r--
py3kcompat: added fake ord implementation for py3k In py3k, a bytes object __getitem__ will return an int instead of a one-character bytes object. This has negative consequences when we want to ord(), like in the following example: >>> b'foo'[0] 102 >>> ord(b'foo'[0]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: ord() expected string of length 1, but int found This patch overrides the default ord() implementation to just return an int that's what is passed as an argument for ord(). Making the above call succeed: >>> ord(b'foo'[0]) 102
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8250
1b60efdb8bc5 convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
     1
# cvs.py: CVS conversion code inspired by hg-cvs-import and git-cvsimport
1b60efdb8bc5 convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
     2
#
1b60efdb8bc5 convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
     3
#  Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
1b60efdb8bc5 convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
     4
#
1b60efdb8bc5 convert: add copyright and license headers to back-ends
Martin Geisler <mg@lazybytes.net>
parents: 8209
diff changeset
     5
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 9543
diff changeset
     6
# GNU General Public License version 2 or any later version.
4516
96d8a56d4ef9 Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4515
diff changeset
     7
7444
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
     8
import os, locale, re, socket, errno
5539
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
     9
from cStringIO import StringIO
4536
cc9b79216a76 Split convert extension into common and repository type modules
Brendan Cully <brendan@kublai.com>
parents: 4532
diff changeset
    10
from mercurial import util
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    11
from mercurial.i18n import _
4447
1b75e0eff532 document conversion interface
Daniel Holth <dholth@fastmail.fm>
parents: 4114
diff changeset
    12
5497
f0a3918abd42 convert: fail if an external required tool is not found
Patrick Mezard <pmezard@gmail.com>
parents: 5381
diff changeset
    13
from common import NoRepo, commit, converter_source, checktool
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    14
import cvsps
4447
1b75e0eff532 document conversion interface
Daniel Holth <dholth@fastmail.fm>
parents: 4114
diff changeset
    15
4448
af013ae3ca10 use documented convert-repo interface
Daniel Holth <dholth@fastmail.fm>
parents: 4447
diff changeset
    16
class convert_cvs(converter_source):
4760
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    17
    def __init__(self, ui, path, rev=None):
4807
15a3cbfc6568 convert: call superclass init from engine init functions
Brendan Cully <brendan@kublai.com>
parents: 4762
diff changeset
    18
        super(convert_cvs, self).__init__(ui, path, rev=rev)
15a3cbfc6568 convert: call superclass init from engine init functions
Brendan Cully <brendan@kublai.com>
parents: 4762
diff changeset
    19
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    20
        cvs = os.path.join(path, "CVS")
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    21
        if not os.path.exists(cvs):
10939
9f6731b03906 convert: mark strings for translation
Martin Geisler <mg@lazybytes.net>
parents: 10800
diff changeset
    22
            raise NoRepo(_("%s does not look like a CVS checkout") % path)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    23
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    24
        checktool('cvs')
5497
f0a3918abd42 convert: fail if an external required tool is not found
Patrick Mezard <pmezard@gmail.com>
parents: 5381
diff changeset
    25
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
    26
        self.changeset = None
3954
9af4b853ed4d convert-repo: add CVS branch support
Matt Mackall <mpm@selenic.com>
parents: 3953
diff changeset
    27
        self.files = {}
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    28
        self.tags = {}
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    29
        self.lastbranch = {}
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    30
        self.socket = None
9031
3b76321aa0de compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents: 8598
diff changeset
    31
        self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1]
3b76321aa0de compat: use open() instead of file() everywhere
Alejandro Santos <alejolp@alejolp.com>
parents: 8598
diff changeset
    32
        self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1]
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    33
        self.encoding = locale.getpreferredencoding()
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    34
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    35
        self._connect()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    36
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
    37
    def _parse(self):
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
    38
        if self.changeset is not None:
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    39
            return
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
    40
        self.changeset = {}
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    41
4760
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    42
        maxrev = 0
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    43
        if self.rev:
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    44
            # TODO: handle tags
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    45
            try:
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    46
                # patchset number?
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    47
                maxrev = int(self.rev)
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    48
            except ValueError:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
    49
                raise util.Abort(_('revision %s is not a patchset number')
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
    50
                                 % self.rev)
4760
07efcce17d28 convert: add -r argument specifying latest revision to convert
Brendan Cully <brendan@kublai.com>
parents: 4759
diff changeset
    51
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    52
        d = os.getcwd()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    53
        try:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    54
            os.chdir(self.path)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    55
            id = None
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    56
            state = 0
5920
5df7cb799baf CVS convert: Find correct parent for new branch (issue704)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5521
diff changeset
    57
            filerevids = {}
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    58
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    59
            cache = 'update'
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    60
            if not self.ui.configbool('convert', 'cvsps.cache', True):
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    61
                cache = None
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    62
            db = cvsps.createlog(self.ui, cache=cache)
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    63
            db = cvsps.createchangeset(self.ui, db,
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    64
                fuzz=int(self.ui.config('convert', 'cvsps.fuzz', 60)),
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    65
                mergeto=self.ui.config('convert', 'cvsps.mergeto', None),
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    66
                mergefrom=self.ui.config('convert', 'cvsps.mergefrom', None))
5920
5df7cb799baf CVS convert: Find correct parent for new branch (issue704)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5521
diff changeset
    67
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    68
            for cs in db:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
    69
                if maxrev and cs.id > maxrev:
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    70
                    break
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    71
                id = str(cs.id)
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    72
                cs.author = self.recode(cs.author)
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    73
                self.lastbranch[cs.branch] = id
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    74
                cs.comment = self.recode(cs.comment)
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    75
                date = util.datestr(cs.date)
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    76
                self.tags.update(dict.fromkeys(cs.tags, id))
5920
5df7cb799baf CVS convert: Find correct parent for new branch (issue704)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5521
diff changeset
    77
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    78
                files = {}
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    79
                for f in cs.entries:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
    80
                    files[f.file] = "%s%s" % ('.'.join([str(x)
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
    81
                                                        for x in f.revision]),
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    82
                                              ['', '(DEAD)'][f.dead])
6690
127e8c3466d1 convert: cvs.py - Allow user to use built-in CVS changeset code.
Frank Kingswood <frank@kingswood-consulting.co.uk>
parents: 6318
diff changeset
    83
9543
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    84
                # add current commit to set
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    85
                c = commit(author=cs.author, date=date,
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    86
                           parents=[str(p.id) for p in cs.parents],
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    87
                           desc=cs.comment, branch=cs.branch or '')
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    88
                self.changeset[id] = c
56a5f80556f5 convert/cvs: stop supporting external cvsps
Patrick Mezard <pmezard@gmail.com>
parents: 9102
diff changeset
    89
                self.files[id] = files
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    90
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    91
            self.heads = self.lastbranch.values()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    92
        finally:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    93
            os.chdir(d)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    94
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    95
    def _connect(self):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    96
        root = self.cvsroot
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
    97
        conntype = None
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    98
        user, host = None, None
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
    99
        cmd = ['cvs', 'server']
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   100
6956
12472a240398 i18n: mark strings for translation in convert extension
Martin Geisler <mg@daimi.au.dk>
parents: 6816
diff changeset
   101
        self.ui.status(_("connecting to %s\n") % root)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   102
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   103
        if root.startswith(":pserver:"):
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   104
            root = root[9:]
4532
c3a78a49d7f0 Some small cleanups for convert extension:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4521
diff changeset
   105
            m = re.match(r'(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?(.*)',
c3a78a49d7f0 Some small cleanups for convert extension:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4521
diff changeset
   106
                         root)
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   107
            if m:
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   108
                conntype = "pserver"
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   109
                user, passw, serv, port, root = m.groups()
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   110
                if not user:
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   111
                    user = "anonymous"
5082
dc2e512cb89a CVS import: Support new-style .cvspass-file format.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4698
diff changeset
   112
                if not port:
dc2e512cb89a CVS import: Support new-style .cvspass-file format.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4698
diff changeset
   113
                    port = 2401
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   114
                else:
5082
dc2e512cb89a CVS import: Support new-style .cvspass-file format.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4698
diff changeset
   115
                    port = int(port)
dc2e512cb89a CVS import: Support new-style .cvspass-file format.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4698
diff changeset
   116
                format0 = ":pserver:%s@%s:%s" % (user, serv, root)
dc2e512cb89a CVS import: Support new-style .cvspass-file format.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4698
diff changeset
   117
                format1 = ":pserver:%s@%s:%d%s" % (user, serv, port, root)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   118
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   119
                if not passw:
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   120
                    passw = "A"
7442
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   121
                    cvspass = os.path.expanduser("~/.cvspass")
7444
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   122
                    try:
7442
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   123
                        pf = open(cvspass)
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   124
                        for line in pf.read().splitlines():
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   125
                            part1, part2 = line.split(' ', 1)
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   126
                            if part1 == '/1':
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   127
                                # /1 :pserver:user@example.com:2401/cvsroot/foo Ah<Z
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   128
                                part1, part2 = part2.split(' ', 1)
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   129
                                format = format1
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   130
                            else:
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   131
                                # :pserver:user@example.com:/cvsroot/foo Ah<Z
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   132
                                format = format0
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   133
                            if part1 == format:
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   134
                                passw = part2
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   135
                                break
a14ce129cfcd convert: check existence of ~/.cvspass before reading it
Edouard Gomez <ed.gomez@free.fr>
parents: 7441
diff changeset
   136
                        pf.close()
7444
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   137
                    except IOError, inst:
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   138
                        if inst.errno != errno.ENOENT:
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   139
                            if not getattr(inst, 'filename', None):
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   140
                                inst.filename = cvspass
f792c7bb2fb3 Improvement to 14ce129cfcd: Use try/except and pass filename on errors
Thomas Arendsen Hein <thomas@intevation.de>
parents: 7442
diff changeset
   141
                            raise
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   142
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   143
                sck = socket.socket()
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   144
                sck.connect((serv, port))
4532
c3a78a49d7f0 Some small cleanups for convert extension:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4521
diff changeset
   145
                sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw,
c3a78a49d7f0 Some small cleanups for convert extension:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4521
diff changeset
   146
                                    "END AUTH REQUEST", ""]))
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   147
                if sck.recv(128) != "I LOVE YOU\n":
6956
12472a240398 i18n: mark strings for translation in convert extension
Martin Geisler <mg@daimi.au.dk>
parents: 6816
diff changeset
   148
                    raise util.Abort(_("CVS pserver authentication failed"))
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   149
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   150
                self.writep = self.readp = sck.makefile('r+')
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   151
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   152
        if not conntype and root.startswith(":local:"):
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   153
            conntype = "local"
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   154
            root = root[7:]
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   155
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   156
        if not conntype:
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   157
            # :ext:user@host/home/user/path/to/cvsroot
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   158
            if root.startswith(":ext:"):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   159
                root = root[5:]
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   160
            m = re.match(r'(?:([^@:/]+)@)?([^:/]+):?(.*)', root)
5304
b85f7cc133cc convert: avoid interpreting Windows path as CVS connection strings.
Patrick Mezard <pmezard@gmail.com>
parents: 5303
diff changeset
   161
            # Do not take Windows path "c:\foo\bar" for a connection strings
b85f7cc133cc convert: avoid interpreting Windows path as CVS connection strings.
Patrick Mezard <pmezard@gmail.com>
parents: 5303
diff changeset
   162
            if os.path.isdir(root) or not m:
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   163
                conntype = "local"
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   164
            else:
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   165
                conntype = "rsh"
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   166
                user, host, root = m.group(1), m.group(2), m.group(3)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   167
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   168
        if conntype != "pserver":
4516
96d8a56d4ef9 Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4515
diff changeset
   169
            if conntype == "rsh":
5860
493632bb171c convert should use default value when CVS_RSH is not set, that value
Kostantinos Koukopoulos <kouk@noc.uoa.gr>
parents: 5539
diff changeset
   170
                rsh = os.environ.get("CVS_RSH") or "ssh"
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   171
                if user:
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   172
                    cmd = [rsh, '-l', user, host] + cmd
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   173
                else:
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   174
                    cmd = [rsh, host] + cmd
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   175
5303
a76c61679b71 convert: call popen2 in binary mode, with a command string.
Patrick Mezard <pmezard@gmail.com>
parents: 5082
diff changeset
   176
            # popen2 does not support argument lists under Windows
a76c61679b71 convert: call popen2 in binary mode, with a command string.
Patrick Mezard <pmezard@gmail.com>
parents: 5082
diff changeset
   177
            cmd = [util.shellquote(arg) for arg in cmd]
a76c61679b71 convert: call popen2 in binary mode, with a command string.
Patrick Mezard <pmezard@gmail.com>
parents: 5082
diff changeset
   178
            cmd = util.quotecommand(' '.join(cmd))
8339
f55869abb5c3 util: remove ignored mode argument in popen[23]
Martin Geisler <mg@lazybytes.net>
parents: 8250
diff changeset
   179
            self.writep, self.readp = util.popen2(cmd)
4047
705d0792dbf2 add pserver support to convert_repo
csaba.henk@creo.hu
parents: 4006
diff changeset
   180
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   181
        self.realroot = root
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   182
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   183
        self.writep.write("Root %s\n" % root)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   184
        self.writep.write("Valid-responses ok error Valid-requests Mode"
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   185
                          " M Mbinary E Checked-in Created Updated"
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   186
                          " Merged Removed\n")
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   187
        self.writep.write("valid-requests\n")
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   188
        self.writep.flush()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   189
        r = self.readp.readline()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   190
        if not r.startswith("Valid-requests"):
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
   191
            raise util.Abort(_('unexpected response from CVS server '
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
   192
                               '(expected "Valid-requests", but got %r)')
9095
89fd11257d75 convert/cvs: improve error message on unexpected server output.
Greg Ward <greg-hg@gerg.ca>
parents: 8598
diff changeset
   193
                             % r)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   194
        if "UseUnchanged" in r:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   195
            self.writep.write("UseUnchanged\n")
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   196
            self.writep.flush()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   197
            r = self.readp.readline()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   198
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   199
    def getheads(self):
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
   200
        self._parse()
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   201
        return self.heads
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   202
11134
33010ff1fd6f convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents: 10939
diff changeset
   203
    def getfile(self, name, rev):
5539
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   204
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   205
        def chunkedread(fp, count):
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   206
            # file-objects returned by socked.makefile() do not handle
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   207
            # large read() requests very well.
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   208
            chunksize = 65536
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   209
            output = StringIO()
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   210
            while count > 0:
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   211
                data = fp.read(min(count, chunksize))
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   212
                if not data:
10282
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
   213
                    raise util.Abort(_("%d bytes missing from remote file")
08a0f04b56bd many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents: 10263
diff changeset
   214
                                     % count)
5539
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   215
                count -= len(data)
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   216
                output.write(data)
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   217
            return output.getvalue()
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   218
11134
33010ff1fd6f convert: merge sources getmode() into getfile()
Patrick Mezard <pmezard@gmail.com>
parents: 10939
diff changeset
   219
        self._parse()
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   220
        if rev.endswith("(DEAD)"):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   221
            raise IOError
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   222
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   223
        args = ("-N -P -kk -r %s --" % rev).split()
5305
87348cdce88c convert: fix remote cvs file paths separator
Patrick Mezard <pmezard@gmail.com>
parents: 5304
diff changeset
   224
        args.append(self.cvsrepo + '/' + name)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   225
        for x in args:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   226
            self.writep.write("Argument %s\n" % x)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   227
        self.writep.write("Directory .\n%s\nco\n" % self.realroot)
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   228
        self.writep.flush()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   229
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   230
        data = ""
10800
49c109d037dd convert.cvs: Initialize state variable and abort on cvs error
Mads Kiilerich <mads@kiilerich.com>
parents: 10282
diff changeset
   231
        mode = None
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   232
        while 1:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   233
            line = self.readp.readline()
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   234
            if line.startswith("Created ") or line.startswith("Updated "):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   235
                self.readp.readline() # path
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   236
                self.readp.readline() # entries
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   237
                mode = self.readp.readline()[:-1]
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   238
                count = int(self.readp.readline()[:-1])
5539
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   239
                data = chunkedread(self.readp, count)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   240
            elif line.startswith(" "):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   241
                data += line[1:]
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   242
            elif line.startswith("M "):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   243
                pass
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   244
            elif line.startswith("Mbinary "):
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   245
                count = int(self.readp.readline()[:-1])
5539
954e68e54dea convert: read CVS files in chunks (issue 800)
Patrick Mezard <pmezard@gmail.com>
parents: 5528
diff changeset
   246
                data = chunkedread(self.readp, count)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   247
            else:
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   248
                if line == "ok\n":
10800
49c109d037dd convert.cvs: Initialize state variable and abort on cvs error
Mads Kiilerich <mads@kiilerich.com>
parents: 10282
diff changeset
   249
                    if mode is None:
49c109d037dd convert.cvs: Initialize state variable and abort on cvs error
Mads Kiilerich <mads@kiilerich.com>
parents: 10282
diff changeset
   250
                        raise util.Abort(_('malformed response from CVS'))
4082
6b2909e84203 convert-repo converts symlinks from git
Daniel Holth <dholth@fastmail.fm>
parents: 4062
diff changeset
   251
                    return (data, "x" in mode and "x" or "")
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   252
                elif line.startswith("E "):
6956
12472a240398 i18n: mark strings for translation in convert extension
Martin Geisler <mg@daimi.au.dk>
parents: 6816
diff changeset
   253
                    self.ui.warn(_("cvs server: %s\n") % line[2:])
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   254
                elif line.startswith("Remove"):
7874
d812029cda85 cleanup: drop variables for unused return values
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7519
diff changeset
   255
                    self.readp.readline()
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   256
                else:
6956
12472a240398 i18n: mark strings for translation in convert extension
Martin Geisler <mg@daimi.au.dk>
parents: 6816
diff changeset
   257
                    raise util.Abort(_("unknown CVS response: %s") % line)
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   258
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   259
    def getchanges(self, rev):
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
   260
        self._parse()
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8169
diff changeset
   261
        return sorted(self.files[rev].iteritems()), {}
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   262
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   263
    def getcommit(self, rev):
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
   264
        self._parse()
3954
9af4b853ed4d convert-repo: add CVS branch support
Matt Mackall <mpm@selenic.com>
parents: 3953
diff changeset
   265
        return self.changeset[rev]
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   266
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   267
    def gettags(self):
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
   268
        self._parse()
3953
fad134931327 convert-repo: add basic CVS import support
Matt Mackall <mpm@selenic.com>
parents: 3939
diff changeset
   269
        return self.tags
5381
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5308
diff changeset
   270
6874368120dc convert_cvs: add --filemap support
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5308
diff changeset
   271
    def getchangedfiles(self, rev, i):
8048
d22432bdcba1 convert/cvs: delay CVS log parsing after initialization (issue1581/2)
Patrick Mezard <pmezard@gmail.com>
parents: 7874
diff changeset
   272
        self._parse()
8209
a1a5a57efe90 replace util.sort with sorted built-in
Matt Mackall <mpm@selenic.com>
parents: 8169
diff changeset
   273
        return sorted(self.files[rev])