Ejemplo n.º 1
0
 def __init__(self, ui, path):
     converter_sink.__init__(self, ui, path)
     self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
     self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
     self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
     self.lastbranch = None
     if os.path.isdir(path) and len(os.listdir(path)) > 0:
         try:
             self.repo = hg.repository(self.ui, path)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repository')
                              % path)
         except error.RepoError as err:
             ui.traceback()
             raise NoRepo(err.args[0])
     else:
         try:
             ui.status(_('initializing destination %s repository\n') % path)
             self.repo = hg.repository(self.ui, path, create=True)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repository')
                              % path)
             self.created.append(path)
         except error.RepoError:
             ui.traceback()
             raise NoRepo(_("could not create hg repository %s as sink")
                          % path)
     self.lock = None
     self.wlock = None
     self.filemapmode = False
     self.subrevmaps = {}
Ejemplo n.º 2
0
 def __init__(self, ui, path):
     converter_sink.__init__(self, ui, path)
     self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
     self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
     self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
     self.lastbranch = None
     if os.path.isdir(path) and len(os.listdir(path)) > 0:
         try:
             self.repo = hg.repository(self.ui, path)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repository')
                              % path)
         except error.RepoError as err:
             ui.traceback()
             raise NoRepo(err.args[0])
     else:
         try:
             ui.status(_('initializing destination %s repository\n') % path)
             self.repo = hg.repository(self.ui, path, create=True)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repository')
                              % path)
             self.created.append(path)
         except error.RepoError:
             ui.traceback()
             raise NoRepo(_("could not create hg repository %s as sink")
                          % path)
     self.lock = None
     self.wlock = None
     self.filemapmode = False
     self.subrevmaps = {}
Ejemplo n.º 3
0
    def __init__(self, ui, path):

        if svn is None:
            raise MissingTool(_('Could not load Subversion python bindings'))
        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()

        path = os.path.realpath(path)

        created = False
        if os.path.isfile(os.path.join(path, '.svn', 'entries')):
            self.wc = path
            self.run0('update')
        else:
            wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')

            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

            ui.status(
                _('initializing svn working copy %r\n') %
                os.path.basename(wcpath))
            self.run0('checkout', path, wcpath)

            self.wc = wcpath
        self.opener = util.opener(self.wc)
        self.wopener = util.opener(self.wc)
        self.childmap = mapfile(ui, self.join('hg-childmap'))
        self.is_exec = util.checkexec(self.wc) and util.is_exec 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.set_flags(hook, False, True)

        xport = transport.SvnRaTransport(url=geturl(path))
        self.uuid = svn.ra.get_uuid(xport.ra)
Ejemplo n.º 4
0
    def __init__(self, ui, path):

        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()

        path = os.path.realpath(path)

        created = False
        if os.path.isfile(os.path.join(path, '.svn', 'entries')):
            self.wc = path
            self.run0('update')
        else:
            wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')

            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

            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()
Ejemplo n.º 5
0
    def __init__(self, ui, path):

        if svn is None:
            raise MissingTool(_('Could not load Subversion python bindings'))
        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()

        path = os.path.realpath(path)

        created = False
        if os.path.isfile(os.path.join(path, '.svn', 'entries')):
            self.wc = path
            self.run0('update')
        else:
            wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')

            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

            ui.status(_('initializing svn working copy %r\n')
                      % os.path.basename(wcpath))
            self.run0('checkout', path, wcpath)

            self.wc = wcpath
        self.opener = util.opener(self.wc)
        self.wopener = util.opener(self.wc)
        self.childmap = mapfile(ui, self.join('hg-childmap'))
        self.is_exec = util.checkexec(self.wc) and util.is_exec 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.set_flags(hook, False, True)

        xport = transport.SvnRaTransport(url=geturl(path))
        self.uuid = svn.ra.get_uuid(xport.ra)
Ejemplo n.º 6
0
    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()
Ejemplo n.º 7
0
 def __init__(self, ui, path):
     converter_sink.__init__(self, ui, path)
     self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
     self.clonebranches = ui.configbool('convert', 'hg.clonebranches', False)
     self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
     self.lastbranch = None
     if os.path.isdir(path) and len(os.listdir(path)) > 0:
         try:
             self.repo = hg.repository(self.ui, path)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repo') % path)
         except error.RepoError, err:
             ui.traceback()
             raise NoRepo(err.args[0])
Ejemplo n.º 8
0
 def __init__(self, ui, path):
     converter_sink.__init__(self, ui, path)
     self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
     self.clonebranches = ui.configbool('convert', 'hg.clonebranches',
                                        False)
     self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
     self.lastbranch = None
     if os.path.isdir(path) and len(os.listdir(path)) > 0:
         try:
             self.repo = hg.repository(self.ui, path)
             if not self.repo.local():
                 raise NoRepo(_('%s is not a local Mercurial repo') % path)
         except error.RepoError, err:
             ui.traceback()
             raise NoRepo(err.args[0])