コード例 #1
0
    def __init__(self, ui, path, rev=None):
        super(convert_cvs, self).__init__(ui, path, rev=rev)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo("%s does not look like a CVS checkout" % path)

        checktool('cvs')
        self.cmd = ui.config('convert', 'cvsps', 'builtin')
        cvspsexe = self.cmd.split(None, 1)[0]
        self.builtin = cvspsexe == 'builtin'
        if not self.builtin:
            ui.warn(
                _('warning: support for external cvsps is deprecated and '
                  'will be removed in Mercurial 1.4\n'))

        if not self.builtin:
            checktool(cvspsexe)

        self.changeset = None
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.socket = None
        self.cvsroot = file(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = locale.getpreferredencoding()

        self._connect()
コード例 #2
0
ファイル: git.py プロジェクト: RayFerr000/PLTL
    def __init__(self, ui, path, rev=None):
        super(convert_git, self).__init__(ui, path, rev=rev)

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        # The default value (50) is based on the default for 'git diff'.
        similarity = ui.configint('convert', 'git.similarity', default=50)
        if similarity < 0 or similarity > 100:
            raise util.Abort(_('similarity must be between 0 and 100'))
        if similarity > 0:
            self.simopt = '-C%d%%' % similarity
            findcopiesharder = ui.configbool('convert', 'git.findcopiesharder',
                                             False)
            if findcopiesharder:
                self.simopt += ' --find-copies-harder'
        else:
            self.simopt = ''

        checktool('git', 'git')

        self.path = path
        self.submodules = []

        self.catfilepipe = self.gitpipe('git cat-file --batch')
コード例 #3
0
ファイル: darcs.py プロジェクト: helloandre/cr48
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, "darcs")

        # check for _darcs, ElementTree so that we can easily skip
        # test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, "_darcs")):
            raise NoRepo(_("%s does not look like a darcs repository") % path)

        checktool("darcs")
        version = self.run0("--version").splitlines()[0].strip()
        if version < "2.1":
            raise util.Abort(_("darcs version 2.1 or newer needed (found %r)") % version)

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available"))

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}

        # Check darcs repository format
        format = self.format()
        if format:
            if format in ("darcs-1.0", "hashed"):
                raise NoRepo(_("%s repository format is unsupported, " "please upgrade") % format)
        else:
            self.ui.warn(_("failed to detect repository format!"))
コード例 #4
0
ファイル: p4.py プロジェクト: MezzLabs/mercurial
    def __init__(self, ui, path, rev=None):
        super(p4_source, self).__init__(ui, path, rev=rev)

        if "/" in path and not path.startswith('//'):
            raise NoRepo(_('%s does not look like a P4 repository') % path)

        checktool('p4', abort=False)

        self.p4changes = {}
        self.heads = {}
        self.changeset = {}
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.encoding = "latin_1"
        self.depotname = {}           # mapping from local name to depot name
        self.re_type = re.compile(
            "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
            "(\+\w+)?$")
        self.re_keywords = re.compile(
            r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
            r":[^$\n]*\$")
        self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")

        self._parse(ui, path)
コード例 #5
0
    def __init__(self, ui, path, rev=None):
        super(p4_source, self).__init__(ui, path, rev=rev)

        if "/" in path and not path.startswith('//'):
            raise NoRepo(_('%s does not look like a P4 repository') % path)

        checktool('p4', abort=False)

        self.p4changes = {}
        self.heads = {}
        self.changeset = {}
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.encoding = "latin_1"
        self.depotname = {}           # mapping from local name to depot name
        self.re_type = re.compile(
            "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
            "(\+\w+)?$")
        self.re_keywords = re.compile(
            r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
            r":[^$\n]*\$")
        self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")

        self._parse(ui, path)
コード例 #6
0
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree so that we can easily skip
        # test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo(_("%s does not look like a darcs repository") % path)

        checktool('darcs', debname='darcs')
        version = self.run0('--version').splitlines()[0].strip()
        if version < '2.1':
            raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') %
                             version)

        if "ElementTree" not in globals():
            raise util.Abort(_("Python ElementTree module is not available") +
                             _(" (try installing the %s package)") % 'python-celementtree')

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}

        # Check darcs repository format
        format = self.format()
        if format:
            if format in ('darcs-1.0', 'hashed'):
                raise NoRepo(_("%s repository format is unsupported, "
                               "please upgrade") % format)
        else:
            self.ui.warn(_('failed to detect repository format!'))
コード例 #7
0
ファイル: git.py プロジェクト: satomi2/ScriptTest
    def __init__(self, ui, path, revs=None):
        super(convert_git, self).__init__(ui, path, revs=revs)
        commandline.__init__(self, ui, 'git')

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        # The default value (50) is based on the default for 'git diff'.
        similarity = ui.configint('convert', 'git.similarity', default=50)
        if similarity < 0 or similarity > 100:
            raise error.Abort(_('similarity must be between 0 and 100'))
        if similarity > 0:
            self.simopt = ['-C%d%%' % similarity]
            findcopiesharder = ui.configbool('convert', 'git.findcopiesharder',
                                             False)
            if findcopiesharder:
                self.simopt.append('--find-copies-harder')
        else:
            self.simopt = []

        checktool('git', 'git')

        self.path = path
        self.submodules = []

        self.catfilepipe = self.gitpipe('cat-file', '--batch')
コード例 #8
0
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree, _darcs/inventory so that we can
        # easily skip test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs', 'inventories')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        checktool('darcs')
        version = self.run0('--version').splitlines()[0].strip()
        if version < '2.1':
            raise util.Abort(
                _('darcs version 2.1 or newer needed (found %r)') % version)

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available"))

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}
コード例 #9
0
ファイル: darcs.py プロジェクト: Nurb432/plan9front
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree, _darcs/inventory so that we can
        # easily skip test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs', 'inventories')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        checktool('darcs')
        version = self.run0('--version').splitlines()[0].strip()
        if version < '2.1':
            raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') %
                             version)

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available"))

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}
コード例 #10
0
ファイル: darcs.py プロジェクト: ezc/mercurial
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree so that we can easily skip
        # test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo(_("%s does not look like a darcs repository") % path)

        checktool('darcs')
        version = self.run0('--version').splitlines()[0].strip()
        if version < '2.1':
            raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') %
                             version)

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available"))

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}

        # Check darcs repository format
        format = self.format()
        if format:
            if format in ('darcs-1.0', 'hashed'):
                raise NoRepo(_("%s repository format is unsupported, "
                               "please upgrade") % format)
        else:
            self.ui.warn(_('failed to detect repository format!'))
コード例 #11
0
ファイル: p4.py プロジェクト: CSCI-362-02-2015/RedTeam
    def __init__(self, ui, path, revs=None):
        # avoid import cycle
        import convcmd

        super(p4_source, self).__init__(ui, path, revs=revs)

        if "/" in path and not path.startswith('//'):
            raise NoRepo(_('%s does not look like a P4 repository') % path)

        checktool('p4', abort=False)

        self.p4changes = {}
        self.heads = {}
        self.changeset = {}
        self.files = {}
        self.copies = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.encoding = self.ui.config('convert', 'p4.encoding',
                                       default=convcmd.orig_encoding)
        self.depotname = {}           # mapping from local name to depot name
        self.localname = {} # mapping from depot name to local name
        self.re_type = re.compile(
            "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
            "(\+\w+)?$")
        self.re_keywords = re.compile(
            r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
            r":[^$\n]*\$")
        self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")

        if revs and len(revs) > 1:
            raise util.Abort(_("p4 source does not support specifying "
                               "multiple revisions"))
        self._parse(ui, path)
コード例 #12
0
ファイル: cvs.py プロジェクト: Nurb432/plan9front
    def __init__(self, ui, path, rev=None):
        super(convert_cvs, self).__init__(ui, path, rev=rev)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo("%s does not look like a CVS checkout" % path)

        checktool('cvs')
        self.cmd = ui.config('convert', 'cvsps', 'builtin')
        cvspsexe = self.cmd.split(None, 1)[0]
        self.builtin = cvspsexe == 'builtin'
        if not self.builtin:
            ui.warn(_('warning: support for external cvsps is deprecated and '
                      'will be removed in Mercurial 1.4\n'))

        if not self.builtin:
            checktool(cvspsexe)

        self.changeset = None
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.socket = None
        self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = locale.getpreferredencoding()

        self._connect()
コード例 #13
0
    def __init__(self, ui, path=None, rev=None):
        converter_source.__init__(self, ui, path, rev)
        commandline.__init__(self, ui, 'mtn')

        self.ui = ui
        self.path = path

        norepo = NoRepo(_("%s does not look like a monotone repository")
                        % path)
        if not os.path.exists(os.path.join(path, '_MTN')):
            # Could be a monotone repository (SQLite db file)
            try:
                header = file(path, 'rb').read(16)
            except:
                header = ''
            if header != 'SQLite format 3\x00':
                raise norepo

        # regular expressions for parsing monotone output
        space    = r'\s*'
        name     = r'\s+"((?:\\"|[^"])*)"\s*'
        value    = name
        revision = r'\s+\[(\w+)\]\s*'
        lines    = r'(?:.|\n)+'

        self.dir_re      = re.compile(space + "dir" + name)
        self.file_re     = re.compile(space + "file" + name +
                                      "content" + revision)
        self.add_file_re = re.compile(space + "add_file" + name +
                                      "content" + revision)
        self.patch_re    = re.compile(space + "patch" + name +
                                      "from" + revision + "to" + revision)
        self.rename_re   = re.compile(space + "rename" + name + "to" + name)
        self.delete_re   = re.compile(space + "delete" + name)
        self.tag_re      = re.compile(space + "tag" + name + "revision" +
                                      revision)
        self.cert_re     = re.compile(lines + space + "name" + name +
                                      "value" + value)

        attr = space + "file" + lines + space + "attr" + space
        self.attr_execute_re = re.compile(attr  + '"mtn:execute"' +
                                          space + '"true"')

        # cached data
        self.manifest_rev = None
        self.manifest = None
        self.files = None
        self.dirs  = None

        checktool('mtn', abort=False)

        # test if there are any revisions
        self.rev = None
        try:
            self.getheads()
        except:
            raise norepo
        self.rev = rev
コード例 #14
0
ファイル: git.py プロジェクト: agbiotec/galaxy-tools-vcr
    def __init__(self, ui, path, rev=None):
        super(convert_git, self).__init__(ui, path, rev=rev)

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        checktool('git', 'git')

        self.path = path
コード例 #15
0
    def __init__(self, ui, path, rev=None):
        super(convert_git, self).__init__(ui, path, rev=rev)

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        checktool('git', 'git')

        self.path = path
コード例 #16
0
ファイル: subversion.py プロジェクト: sitano/hgext
    def __init__(self, ui, path):
        checktool('svn', debname='subversion')
        checktool('svnadmin', debname='subversion')

        converter_sink.__init__(self, ui, path)
        commandline.__init__(self, ui, 'svn')
        self.delete = []
        self.setexec = []
        self.delexec = []
        self.copies = []
        self.wc = None
        self.cwd = os.getcwd()

        created = False
        if os.path.isfile(os.path.join(path, '.svn', 'entries')):
            self.wc = os.path.realpath(path)
            self.run0('update')
        else:
            if not re.search(r'^(file|http|https|svn|svn\+ssh)\://', path):
                path = os.path.realpath(path)
                if os.path.isdir(os.path.dirname(path)):
                    if not os.path.exists(os.path.join(path, 'db', 'fs-type')):
                        ui.status(_('initializing svn repository %r\n') %
                                  os.path.basename(path))
                        commandline(ui, 'svnadmin').run0('create', path)
                        created = path
                    path = util.normpath(path)
                    if not path.startswith('/'):
                        path = '/' + path
                    path = 'file://' + path

            wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')
            ui.status(_('initializing svn working copy %r\n')
                      % os.path.basename(wcpath))
            self.run0('checkout', path, wcpath)

            self.wc = wcpath
        self.opener = scmutil.opener(self.wc)
        self.wopener = scmutil.opener(self.wc)
        self.childmap = mapfile(ui, self.join('hg-childmap'))
        self.is_exec = util.checkexec(self.wc) and util.isexec or None

        if created:
            hook = os.path.join(created, 'hooks', 'pre-revprop-change')
            fp = open(hook, 'w')
            fp.write(pre_revprop_change)
            fp.close()
            util.setflags(hook, False, True)

        output = self.run0('info')
        self.uuid = self.uuid_re.search(output).group(1).strip()
コード例 #17
0
ファイル: monotone.py プロジェクト: html-shell/mozilla-build
    def __init__(self, ui, path=None, revs=None):
        converter_source.__init__(self, ui, path, revs)
        if revs and len(revs) > 1:
            raise error.Abort(_("monotone source does not support specifying " "multiple revs"))
        commandline.__init__(self, ui, "mtn")

        self.ui = ui
        self.path = path
        self.automatestdio = False
        self.revs = revs

        norepo = NoRepo(_("%s does not look like a monotone repository") % path)
        if not os.path.exists(os.path.join(path, "_MTN")):
            # Could be a monotone repository (SQLite db file)
            try:
                f = file(path, "rb")
                header = f.read(16)
                f.close()
            except IOError:
                header = ""
            if header != "SQLite format 3\x00":
                raise norepo

        # regular expressions for parsing monotone output
        space = r"\s*"
        name = r'\s+"((?:\\"|[^"])*)"\s*'
        value = name
        revision = r"\s+\[(\w+)\]\s*"
        lines = r"(?:.|\n)+"

        self.dir_re = re.compile(space + "dir" + name)
        self.file_re = re.compile(space + "file" + name + "content" + revision)
        self.add_file_re = re.compile(space + "add_file" + name + "content" + revision)
        self.patch_re = re.compile(space + "patch" + name + "from" + revision + "to" + revision)
        self.rename_re = re.compile(space + "rename" + name + "to" + name)
        self.delete_re = re.compile(space + "delete" + name)
        self.tag_re = re.compile(space + "tag" + name + "revision" + revision)
        self.cert_re = re.compile(lines + space + "name" + name + "value" + value)

        attr = space + "file" + lines + space + "attr" + space
        self.attr_execute_re = re.compile(attr + '"mtn:execute"' + space + '"true"')

        # cached data
        self.manifest_rev = None
        self.manifest = None
        self.files = None
        self.dirs = None

        checktool("mtn", abort=False)
コード例 #18
0
ファイル: git.py プロジェクト: roopakparikh/crane-node-hello
    def __init__(self, ui, path, rev=None):
        super(convert_git, self).__init__(ui, path, rev=rev)
        commandline.__init__(self, ui, 'git')

        # Pass an absolute path to git to prevent from ever being interpreted
        # as a URL
        path = os.path.abspath(path)

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        checktool('git', 'git', debname='git-core')

        self.path = path
        self.submodules = []

        self.catfilepipe = self.gitpipe('cat-file', '--batch')
コード例 #19
0
    def __init__(self, ui, path, rev=None):
        super(convert_git, self).__init__(ui, path, rev=rev)
        commandline.__init__(self, ui, 'git')

        # Pass an absolute path to git to prevent from ever being interpreted
        # as a URL
        path = os.path.abspath(path)

        if os.path.isdir(path + "/.git"):
            path += "/.git"
        if not os.path.exists(path + "/objects"):
            raise NoRepo(_("%s does not look like a Git repository") % path)

        checktool('git', 'git', debname='git-core')

        self.path = path
        self.submodules = []

        self.catfilepipe = self.gitpipe('cat-file', '--batch')
コード例 #20
0
ファイル: cvs.py プロジェクト: pierfort123/mercurial
    def __init__(self, ui, path, rev=None):
        super(convert_cvs, self).__init__(ui, path, rev=rev)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo(_("%s does not look like a CVS checkout") % path)

        checktool('cvs')

        self.changeset = None
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.socket = None
        self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = encoding.encoding

        self._connect()
コード例 #21
0
ファイル: cvs.py プロジェクト: CSCI-362-02-2015/RedTeam
    def __init__(self, ui, path, revs=None):
        super(convert_cvs, self).__init__(ui, path, revs=revs)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo(_("%s does not look like a CVS checkout") % path)

        checktool('cvs')

        self.changeset = None
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.socket = None
        self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = encoding.encoding

        self._connect()
コード例 #22
0
ファイル: cvs.py プロジェクト: Techlord-RCE/cygwin
    def __init__(self, ui, path, rev=None):
        super(convert_cvs, self).__init__(ui, path, rev=rev)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo("%s does not look like a CVS checkout" % path)

        self.cmd = ui.config('convert', 'cvsps', 'cvsps -A -u --cvs-direct -q')
        cvspsexe = self.cmd.split(None, 1)[0]
        for tool in (cvspsexe, 'cvs'):
            checktool(tool)

        self.changeset = {}
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.socket = None
        self.cvsroot = file(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = locale.getpreferredencoding()
        self._parse()
        self._connect()
コード例 #23
0
ファイル: darcs.py プロジェクト: saminigod/cygwin
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree, _darcs/inventory so that we can
        # easily skip test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        checktool('darcs')

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available"))

        if not os.path.exists(os.path.join(path, '_darcs', 'inventory')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}
コード例 #24
0
ファイル: cvs.py プロジェクト: carlgao/lenga
    def __init__(self, ui, path, rev=None):
        super(convert_cvs, self).__init__(ui, path, rev=rev)

        cvs = os.path.join(path, "CVS")
        if not os.path.exists(cvs):
            raise NoRepo("%s does not look like a CVS checkout" % path)

        self.cmd = ui.config('convert', 'cvsps', 'cvsps -A -u --cvs-direct -q')
        cvspsexe = self.cmd.split(None, 1)[0]
        for tool in (cvspsexe, 'cvs'):
            checktool(tool)

        self.changeset = {}
        self.files = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.socket = None
        self.cvsroot = file(os.path.join(cvs, "Root")).read()[:-1]
        self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1]
        self.encoding = locale.getpreferredencoding()
        self._parse()
        self._connect()
コード例 #25
0
ファイル: darcs.py プロジェクト: carlgao/lenga
    def __init__(self, ui, path, rev=None):
        converter_source.__init__(self, ui, path, rev=rev)
        commandline.__init__(self, ui, 'darcs')

        # check for _darcs, ElementTree, _darcs/inventory so that we can
        # easily skip test-convert-darcs if ElementTree is not around
        if not os.path.exists(os.path.join(path, '_darcs')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        checktool('darcs')

        if ElementTree is None:
            raise util.Abort(_("Python ElementTree module is not available. Try installing the python-elementtree Debian package to convert from darcs"))

        if not os.path.exists(os.path.join(path, '_darcs', 'inventory')):
            raise NoRepo("%s does not look like a darcs repo" % path)

        self.path = os.path.realpath(path)

        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}
コード例 #26
0
    def __init__(self, ui, path, revs=None):
        # avoid import cycle
        import convcmd

        super(p4_source, self).__init__(ui, path, revs=revs)

        if "/" in path and not path.startswith('//'):
            raise NoRepo(_('%s does not look like a P4 repository') % path)

        checktool('p4', abort=False)

        self.p4changes = {}
        self.heads = {}
        self.changeset = {}
        self.files = {}
        self.copies = {}
        self.tags = {}
        self.lastbranch = {}
        self.parent = {}
        self.encoding = self.ui.config('convert',
                                       'p4.encoding',
                                       default=convcmd.orig_encoding)
        self.depotname = {}  # mapping from local name to depot name
        self.localname = {}  # mapping from depot name to local name
        self.re_type = re.compile(
            "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
            "(\+\w+)?$")
        self.re_keywords = re.compile(
            r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
            r":[^$\n]*\$")
        self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")

        if revs and len(revs) > 1:
            raise util.Abort(
                _("p4 source does not support specifying "
                  "multiple revisions"))
        self._parse(ui, path)