コード例 #1
0
ファイル: svn_fs.py プロジェクト: vocho/openqnx
    def __init__(self, path, authz):
        Repository.__init__(self, authz)

        if core.SVN_VER_MAJOR < 1:
            raise TracError, \
                  "Subversion >= 1.0 required: Found %d.%d.%d" % \
                  (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)

        self.repos = None
        self.fs_ptr = None
        self.path = path

        # Remove any trailing slash or else subversion might abort
        if not os.path.split(path)[1]:
            path = os.path.split(path)[0]
        self.path = repos.svn_repos_find_root_path(path)
        if self.path is None:
            raise TracError, "%s does not appear to be a Subversion repository." % (path, )
        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'

        self.repos = repos.svn_repos_open(self.path)
        self.fs_ptr = repos.svn_repos_fs(self.repos)
        self.rev = fs.youngest_rev(self.fs_ptr)

        self.history = None
        if self.scope != '/':
            self.history = []
            for path,rev in _get_history(self.scope[1:], self.authz,
                                         self.fs_ptr, 0, self.rev):
                self.history.append(rev)
コード例 #2
0
    def __init__(self, path, authz, log):
        self.path = path  # might be needed by __del__()/close()
        self.log = log
        if core.SVN_VER_MAJOR < 1:
            raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \
                            (core.SVN_VER_MAJOR,
                             core.SVN_VER_MINOR,
                             core.SVN_VER_MICRO))
        self.pool = Pool()

        # Remove any trailing slash or else subversion might abort
        if isinstance(path, unicode):
            path = path.encode('utf-8')
        path = os.path.normpath(path).replace('\\', '/')
        self.path = repos.svn_repos_find_root_path(path, self.pool())
        if self.path is None:
            raise TracError("%s does not appear to be a Subversion repository." \
                            % path)

        self.repos = repos.svn_repos_open(self.path, self.pool())
        self.fs_ptr = repos.svn_repos_fs(self.repos)

        uuid = fs.get_uuid(self.fs_ptr, self.pool())
        name = 'svn:%s:%s' % (uuid, _from_svn(path))

        Repository.__init__(self, name, authz, log)

        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'
        assert self.scope[0] == '/'
        self.clear()
コード例 #3
0
    def __init__(self, name, log, options):
        log.debug("*** __init__ repository (is init: %d)" %
                  (self.__class__.p4init))
        Repository.__init__(self, name, None, log)
        if self.__class__.p4init == 0:
            self.__class__.p4init = 1
            self.__class__.p4c = p4.P4()
            self.__class__.p4c.port = options['port']
            self.__class__.p4c.user = options['user']
            self.__class__.p4c.client = options['client']
            self.__class__.p4c.password = options['passwd']
            self.__class__.p4c.parse_forms()
            try:
                self.__class__.p4c.connect()
                log.debug("*** __init__ repository connected !!!")
            except self.__class__.p4c.P4Error:
                for e in p4.errors:
                    self.log.debug(e)
                self.__class__.p4init = 0

        try:
            # cache the first few changes
            self.__class__.history = []
            changes = self.__class__.p4c.run_changes("-m", "10", "-s",
                                                     "submitted")
            for change in changes:
                self.__class__.history.append(change['change'])

        except:
            for e in self.__class__.p4c.errors:
                self.log.debug(e)
            self.__class__.p4init = 0
コード例 #4
0
ファイル: cache.py プロジェクト: gdgkyoto/kyoto-gtug
 def __init__(self, getdb, repos, authz, log):
     Repository.__init__(self, repos.name, authz, log)
     if callable(getdb):
         self.getdb = getdb
     else:
         self.getdb = lambda: getdb
     self.repos = repos
コード例 #5
0
ファイル: cache.py プロジェクト: wiraqutra/photrackjp
 def __init__(self, env, repos, log):
     self.env = env
     self.repos = repos
     self._metadata_id = (CachedRepository.__module__ + '.' +
                          CachedRepository.__name__ + '.metadata:' +
                          str(self.repos.id))
     Repository.__init__(self, repos.name, repos.params, log)
コード例 #6
0
ファイル: svn_fs.py プロジェクト: zhxhxlzt/subversion
    def __init__(self, path, authz):
        Repository.__init__(self, authz)

        if core.SVN_VER_MAJOR < 1:
            raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \
                  (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO))

        self.repos = None
        self.fs_ptr = None
        self.path = path

        # Remove any trailing slash or else subversion might abort
        if not os.path.split(path)[1]:
            path = os.path.split(path)[0]
        self.path = repos.svn_repos_find_root_path(path)
        if self.path is None:
            raise TracError(
                "%s does not appear to be a Subversion repository." % (path, ))
        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1:] == b'/':
                self.scope += b'/'
        else:
            self.scope = b'/'

        self.repos = repos.svn_repos_open(self.path)
        self.fs_ptr = repos.svn_repos_fs(self.repos)
        self.rev = fs.youngest_rev(self.fs_ptr)

        self.history = None
        if self.scope != b'/':
            self.history = []
            for path, rev in _get_history(self.scope[1:], self.authz,
                                          self.fs_ptr, 0, self.rev):
                self.history.append(rev)
コード例 #7
0
ファイル: svn_fs.py プロジェクト: cyphactor/lifecyclemanager
    def __init__(self, path, authz, log):
        self.path = path # might be needed by __del__()/close()
        self.log = log
        if core.SVN_VER_MAJOR < 1:
            raise TracError("Subversion >= 1.0 required: Found %d.%d.%d" % \
                            (core.SVN_VER_MAJOR,
                             core.SVN_VER_MINOR,
                             core.SVN_VER_MICRO))
        self.pool = Pool()
        
        # Remove any trailing slash or else subversion might abort
        if isinstance(path, unicode):
            path = path.encode('utf-8')
        path = os.path.normpath(path).replace('\\', '/')
        self.path = repos.svn_repos_find_root_path(path, self.pool())
        if self.path is None:
            raise TracError("%s does not appear to be a Subversion repository." \
                            % path)

        self.repos = repos.svn_repos_open(self.path, self.pool())
        self.fs_ptr = repos.svn_repos_fs(self.repos)
        
        uuid = fs.get_uuid(self.fs_ptr, self.pool())
        name = 'svn:%s:%s' % (uuid, _from_svn(path))

        Repository.__init__(self, name, authz, log)

        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'
        assert self.scope[0] == '/'
        self.clear()
コード例 #8
0
ファイル: p4trac.py プロジェクト: nyuhuhuu/trachacks
    def __init__(self, name, log, options):
        log.debug("*** __init__ repository (is init: %d)" % (self.__class__.p4init))
        Repository.__init__(self, name, None, log)
        if self.__class__.p4init == 0:
            self.__class__.p4init = 1
            self.__class__.p4c = p4.P4()
            self.__class__.p4c.port = options['port']
            self.__class__.p4c.user = options['user']
            self.__class__.p4c.client = options['client']
            self.__class__.p4c.password = options['passwd']
            self.__class__.p4c.parse_forms()
            try:
                self.__class__.p4c.connect()
                log.debug("*** __init__ repository connected !!!")
            except self.__class__.p4c.P4Error:
                for e in p4.errors:
                    self.log.debug(e)
                self.__class__.p4init = 0

        try:
            # cache the first few changes
            self.__class__.history = []
            changes = self.__class__.p4c.run_changes("-m", "10", "-s", "submitted")
            for change in changes:
                self.__class__.history.append(change['change'])

        except:
            for e in self.__class__.p4c.errors:
                self.log.debug(e)
            self.__class__.p4init = 0
コード例 #9
0
ファイル: cache.py プロジェクト: wiraqutra/photrackjp
 def __init__(self, env, repos, log):
     self.env = env
     self.repos = repos
     self._metadata_id = (CachedRepository.__module__ + '.'
                          + CachedRepository.__name__ + '.metadata:'
                          + str(self.repos.id))
     Repository.__init__(self, repos.name, repos.params, log)
コード例 #10
0
ファイル: api.py プロジェクト: nyuhuhuu/trachacks
 def __init__(self, connection, authz, log, jobPrefixLength):
     self._job_prefix_length = jobPrefixLength
     self._connection = connection
     name = 'p4://%s:%s@%s' % (self._connection.user, self._connection.password, self._connection.port)
     Repository.__init__(self, name, None, log)
     # The Repository object that we query for Perforce info
     from p4trac.repos import P4Repository
     self._repos = P4Repository(connection, log)
コード例 #11
0
ファイル: api.py プロジェクト: fictitious/tracperforceplugin
 def __init__(self, connection, authz, log, jobPrefixLength, options={}):
     self._job_prefix_length = jobPrefixLength
     self.options = options
     self._connection = connection
     name = 'p4://%s@%s' % (connection.user, connection.port)
     Repository.__init__(self, name, authz, log)
     from p4trac.repos import P4Repository
     self._repos = P4Repository(connection, log)
コード例 #12
0
ファイル: api.py プロジェクト: modprods/trac-perforceplugin
 def __init__(self, connection, authz, log, jobPrefixLength, options={}):
     self._job_prefix_length = jobPrefixLength
     self.options = options
     self._connection = connection
     name = 'p4://%s@%s' % (connection.user, connection.port)
     Repository.__init__(self, name, options, log)
     from p4trac.repos import P4Repository
     self._repos = P4Repository(connection, log)
コード例 #13
0
 def __init__(self, connection, authz, log, jobPrefixLength):
     self._job_prefix_length = jobPrefixLength
     self._connection = connection
     name = 'p4://%s:%s@%s' % (self._connection.user,
                               self._connection.password,
                               self._connection.port)
     Repository.__init__(self, name, None, log)
     # The Repository object that we query for Perforce info
     from p4trac.repos import P4Repository
     self._repos = P4Repository(connection, log)
コード例 #14
0
    def __init__(self, path, params, log):
        self.log = log
        self.pool = Pool()

        # Remove any trailing slash or else subversion might abort
        if isinstance(path, unicode):
            path_utf8 = path.encode('utf-8')
        else: # note that this should usually not happen (unicode arg expected)
            path_utf8 = to_unicode(path).encode('utf-8')

        path_utf8 = core.svn_path_canonicalize(
                                os.path.normpath(path_utf8).replace('\\', '/'))
        self.path = path_utf8.decode('utf-8')

        root_path_utf8 = repos.svn_repos_find_root_path(path_utf8, self.pool())
        if root_path_utf8 is None:
            raise InvalidRepository(
                _("%(path)s does not appear to be a Subversion repository.",
                  path=to_unicode(path_utf8)))

        try:
            self.repos = repos.svn_repos_open(root_path_utf8, self.pool())
        except core.SubversionException as e:
            raise InvalidRepository(
                _("Couldn't open Subversion repository %(path)s: "
                  "%(svn_error)s", path=to_unicode(path_utf8),
                  svn_error=exception_to_unicode(e)))
        self.fs_ptr = repos.svn_repos_fs(self.repos)

        self.uuid = fs.get_uuid(self.fs_ptr, self.pool())
        self.base = 'svn:%s:%s' % (self.uuid, _from_svn(root_path_utf8))
        name = 'svn:%s:%s' % (self.uuid, self.path)

        Repository.__init__(self, name, params, log)

        # if root_path_utf8 is shorter than the path_utf8, the difference is
        # this scope (which always starts with a '/')
        if root_path_utf8 != path_utf8:
            self.scope = path_utf8[len(root_path_utf8):].decode('utf-8')
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'
        assert self.scope[0] == '/'
        # we keep root_path_utf8 for  RA
        ra_prefix = 'file:///' if os.name == 'nt' else 'file://'
        self.ra_url_utf8 = _svn_uri_canonicalize(ra_prefix +
                                                 quote(root_path_utf8))
        self.clear()
コード例 #15
0
ファイル: svn_fs.py プロジェクト: pkdevbox/trac
    def __init__(self, path, params, log):
        self.log = log
        self.pool = Pool()

        # Remove any trailing slash or else subversion might abort
        if isinstance(path, unicode):
            path_utf8 = path.encode('utf-8')
        else: # note that this should usually not happen (unicode arg expected)
            path_utf8 = to_unicode(path).encode('utf-8')

        path_utf8 = core.svn_path_canonicalize(
                                os.path.normpath(path_utf8).replace('\\', '/'))
        self.path = path_utf8.decode('utf-8')

        root_path_utf8 = repos.svn_repos_find_root_path(path_utf8, self.pool())
        if root_path_utf8 is None:
            raise InvalidRepository(
                _("%(path)s does not appear to be a Subversion repository.",
                  path=to_unicode(path_utf8)))

        try:
            self.repos = repos.svn_repos_open(root_path_utf8, self.pool())
        except core.SubversionException as e:
            raise InvalidRepository(
                _("Couldn't open Subversion repository %(path)s: "
                  "%(svn_error)s", path=to_unicode(path_utf8),
                  svn_error=exception_to_unicode(e)))
        self.fs_ptr = repos.svn_repos_fs(self.repos)

        self.uuid = fs.get_uuid(self.fs_ptr, self.pool())
        self.base = 'svn:%s:%s' % (self.uuid, _from_svn(root_path_utf8))
        name = 'svn:%s:%s' % (self.uuid, self.path)

        Repository.__init__(self, name, params, log)

        # if root_path_utf8 is shorter than the path_utf8, the difference is
        # this scope (which always starts with a '/')
        if root_path_utf8 != path_utf8:
            self.scope = path_utf8[len(root_path_utf8):].decode('utf-8')
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'
        assert self.scope[0] == '/'
        # we keep root_path_utf8 for  RA
        ra_prefix = 'file:///' if os.name == 'nt' else 'file://'
        self.ra_url_utf8 = _svn_uri_canonicalize(ra_prefix +
                                                 quote(root_path_utf8))
        self.clear()
コード例 #16
0
 def __init__(self, path, log, options):
     self.ui = trac_ui()
     if isinstance(path, unicode):
         str_path = path.encode('utf-8')
         if not os.path.exists(str_path):
             str_path = path.encode('latin-1')
         path = str_path
     self.repo = hg.repository(ui=self.ui, path=path)
     self.path = self.repo.root
     self._show_rev = True
     if 'show_rev' in options and not options['show_rev'] in TRUE:
         self._show_rev = False
     self._node_fmt = 'node_format' in options \
                      and options['node_format']    # will default to 'short'
     if self.path is None:
         raise TracError(path + ' does not appear to ' \
                         'contain a Mercurial repository.')
     Repository.__init__(self, 'hg:%s' % path, None, log)
コード例 #17
0
ファイル: p4trac.py プロジェクト: nyuhuhuu/trachacks
    def __init__(self, name, log, options):
        Repository.__init__(self, name, None, log)
        self.p4c = p4.P4()
        self.p4c.port = options['port']
        self.p4c.user = options['user']
        self.p4c.client = options['client']
        self.p4c.password = options['passwd']
        self.p4c.parse_forms()
        try:
            self.p4c.connect()
            # cache the first few changes
            self.history = []
            changes = self.p4c.run("changes", "-m", "options['maxItems']", "-s", "submitted")
            for change in changes:
                self.history.append(change['change'])

        except self.p4c.P4Error:
            for e in p4.errors:
                self.log.debug(e)
コード例 #18
0
    def __init__(self, name, log, options):
        Repository.__init__(self, name, None, log)
        self.p4c = p4.P4()
        self.p4c.port = options['port']
        self.p4c.user = options['user']
        self.p4c.client = options['client']
        self.p4c.password = options['passwd']
        self.p4c.parse_forms()
        try:
            self.p4c.connect()
            # cache the first few changes
            self.history = []
            changes = self.p4c.run("changes", "-m", "options['maxItems']",
                                   "-s", "submitted")
            for change in changes:
                self.history.append(change['change'])

        except self.p4c.P4Error:
            for e in p4.errors:
                self.log.debug(e)
コード例 #19
0
ファイル: svn_fs.py プロジェクト: omunroe-com/tracdebdev
    def __init__(self, path, authz, log):
        if core.SVN_VER_MAJOR < 1:
            raise TracError, \
                  "Subversion >= 1.0 required: Found %d.%d.%d" % \
                  (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_MICRO)

        self.pool = Pool()

        # Remove any trailing slash or else subversion might abort
        if not os.path.split(path)[1]:
            path = os.path.split(path)[0]
        self.path = repos.svn_repos_find_root_path(path, self.pool())
        if self.path is None:
            raise TracError, \
                  "%s does not appear to be a Subversion repository." % path

        self.repos = repos.svn_repos_open(self.path, self.pool())
        self.fs_ptr = repos.svn_repos_fs(self.repos)

        uuid = fs.get_uuid(self.fs_ptr, self.pool())
        name = 'svn:%s:%s' % (uuid, path)

        Repository.__init__(self, name, authz, log)

        if self.path != path:
            self.scope = path[len(self.path):]
            if not self.scope[-1] == '/':
                self.scope += '/'
        else:
            self.scope = '/'
        self.log.debug("Opening subversion file-system at %s with scope %s" \
                       % (self.path, self.scope))

        self.rev = fs.youngest_rev(self.fs_ptr, self.pool())

        self.history = None
        if self.scope != '/':
            self.history = []
            for path, rev in _get_history(self.scope[1:], self.authz,
                                          self.fs_ptr, self.pool, 0, self.rev):
                self.history.append(rev)
コード例 #20
0
ファイル: p4trac.py プロジェクト: nyuhuhuu/trachacks
    def __init__(self, name, log, options):
        # log.debug("*** __init__ repository (is init: %d)" % (self.__class__.p4init))
        Repository.__init__(self, name, None, log)
        if self.__class__.p4init == 0:
            self.__class__.p4init = 1
            self.__class__.p4c = p4.P4()
            self.__class__.p4c.port = options["port"]
            self.__class__.p4c.user = options["user"]
            self.__class__.p4c.client = options["client"]
            self.__class__.p4c.password = options["passwd"]
            self.__class__.p4c.parse_forms()
            try:
                self.__class__.p4c.connect()
            except self.__class__.p4c.P4Error:
                for e in p4.errors:
                    self.log.debug(e)
                self.__class__.p4init = 0

            # cache the first few changes
            self.__class__.history = []
            changes = self.__class__.p4c.run("changes", "-m", "10", "-s", "submitted")
            for change in changes:
                self.__class__.history.append(change["change"])
コード例 #21
0
 def __init__(self, path, log, options):
     self.gitrepo = path
     self.git = PyGIT.Storage(path)
     Repository.__init__(self, "git:" + path, None, log)
コード例 #22
0
ファイル: cache.py プロジェクト: exocad/exotrac
 def parent_revs(self, rev):
     if self.has_linear_changesets:
         return Repository.parent_revs(self, rev)
     else:
         return self.repos.parent_revs(rev)
コード例 #23
0
ファイル: cache.py プロジェクト: nyuhuhuu/trachacks
 def __init__(self, db, repos, authz, log):
     Repository.__init__(self, repos.name, authz, log)
     self.db = db
     self.repos = repos
     self.sync()
コード例 #24
0
 def __init__(self, path, log, options):
     self.gitrepo = path
     self.git = PyGIT.Storage(path)
     Repository.__init__(self, "git:" + path, None, log)
コード例 #25
0
ファイル: cache.py プロジェクト: Stackato-Apps/bloodhound
 def __init__(self, env, repos, log):
     self.env = env
     self.repos = repos
     self._metadata_id = str(self.repos.id)
     Repository.__init__(self, repos.name, repos.params, log)
コード例 #26
0
ファイル: cache.py プロジェクト: pombredanne/trachacks
 def __init__(self, db, repos, authz, log):
     Repository.__init__(self, repos.name, authz, log)
     self.db = db
     self.repos = repos
     self.sync()
コード例 #27
0
ファイル: cache.py プロジェクト: miihael/trac
 def parent_revs(self, rev):
     if self.has_linear_changesets:
         return Repository.parent_revs(self, rev)
     else:
         return self.repos.parent_revs(rev)
コード例 #28
0
ファイル: cache.py プロジェクト: miihael/trac
 def __init__(self, env, repos, log):
     self.env = env
     self.repos = repos
     self._metadata_id = str(self.repos.id)
     Repository.__init__(self, repos.name, repos.params, log)