本文整理汇总了Python中trac.versioncontrol.api.RepositoryManager.get_repository_by_path方法的典型用法代码示例。如果您正苦于以下问题:Python RepositoryManager.get_repository_by_path方法的具体用法?Python RepositoryManager.get_repository_by_path怎么用?Python RepositoryManager.get_repository_by_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.versioncontrol.api.RepositoryManager
的用法示例。
在下文中一共展示了RepositoryManager.get_repository_by_path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
if req.method != 'POST':
msg = u'Method not allowed (%s)\n' % req.method
req.send(msg.encode('utf-8'), 'text/plain', 405)
if req.args.get('token') != self.token:
msg = u'Invalid token (%s)\n' % req.args.get('token')
req.send(msg.encode('utf-8'), 'text/plain', 403)
path = req.args.get('path', '/')
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
output = u'Running hook on %s\n' % (reponame or '(default)')
if self.autofetch:
git = repos.git.repo
output += u'* Running git fetch\n'
output += git.fetch()
output += u'* Updating references\n'
remote_refs = git.for_each_ref(
"--format=%(refname)", "refs/remotes/origin").split()
for remote_ref in remote_refs:
local_ref = remote_ref.replace('remotes/origin', 'heads', 1)
output += git.update_ref(local_ref, remote_ref)
data = req.args.get('payload')
if data:
revs = [commit['id'] for commit in json.loads(data)['commits']]
if revs:
output += u'* Adding changesets %s\n' % u', '.join(revs)
rm.notify('changeset_added', reponame, revs)
req.send(output.encode('utf-8'), 'text/plain', 200 if output else 204)
示例2: _get_vcs_folders
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _get_vcs_folders(self, req, q, dirname, prefix):
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(dirname)
repo_entries = {'text': _('Suggestions'),
'children': [],
}
if repos:
try:
entries = ({'id': '/' + pathjoin(repos.reponame, e.path),
'text': '/' + pathjoin(repos.reponame, e.path),
'is_favorite': False
}
for e in repos.get_node(path).get_entries()
if e.can_view(req.perm)
and e.name.lower().startswith(prefix)
and e.isdir
)
repo_entries['children'].extend(entries)
if q.endswith('/'):
repo_entries['children'].append({'id': q,
'text': q,
'is_favorite': False
}
)
except NoSuchNode:
pass
return repo_entries
示例3: _format_link
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _format_link(self, formatter, ns, match, label, fullmatch=None):
if ns == 'log1':
groups = fullmatch.groupdict()
it_log = groups.get('it_log')
revs = groups.get('log_revs')
path = groups.get('log_path') or '/'
target = '%s%[email protected]%s' % (it_log, path, revs)
# prepending it_log is needed, as the helper expects it there
intertrac = formatter.shorthand_intertrac_helper(
'log', target, label, fullmatch)
if intertrac:
return intertrac
path, query, fragment = formatter.split_link(path)
else:
assert ns in ('log', 'log2')
if ns == 'log':
match, query, fragment = formatter.split_link(match)
else:
query = fragment = ''
match = ''.join(reversed(match.split('/', 1)))
path = match
revs = ''
if self.LOG_LINK_RE.match(match):
indexes = [sep in match and match.index(sep) for sep in ':@']
idx = min([i for i in indexes if i is not False])
path, revs = match[:idx], match[idx+1:]
rm = RepositoryManager(self.env)
try:
reponame, repos, path = rm.get_repository_by_path(path)
if not reponame:
reponame = rm.get_default_repository(formatter.context)
if reponame is not None:
repos = rm.get_repository(reponame)
if repos:
if 'LOG_VIEW' in formatter.perm:
reponame = repos.reponame or None
path = path or '/'
revranges = RevRanges(repos, revs)
if revranges.has_ranges():
href = formatter.href.log(reponame, path,
revs=unicode(revranges))
else:
# try to resolve if single rev
repos.normalize_rev(revs)
href = formatter.href.log(reponame, path,
rev=revs or None)
if query and '?' in href:
query = '&' + query[1:]
return tag.a(label, class_='source',
href=href + query + fragment)
errmsg = _("No permission to view change log")
elif reponame:
errmsg = _("Repository '%(repo)s' not found", repo=reponame)
else:
errmsg = _("No default repository defined")
except TracError, e:
errmsg = to_unicode(e)
示例4: _get_repository
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _get_repository(env, req):
'''From env and req identify and return (reponame, repository, path),
removing reponame from path in the process.
'''
path = req.args.get('path')
repo_mgr = RepositoryManager(env)
reponame, repos, path = repo_mgr.get_repository_by_path(path)
return reponame, repos, path
示例5: _format_link
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _format_link(self, formatter, ns, match, label, fullmatch=None):
if ns == "log1":
groups = fullmatch.groupdict()
it_log = groups.get("it_log")
revs = groups.get("log_revs")
path = groups.get("log_path") or "/"
target = "%s%[email protected]%s" % (it_log, path, revs)
# prepending it_log is needed, as the helper expects it there
intertrac = formatter.shorthand_intertrac_helper("log", target, label, fullmatch)
if intertrac:
return intertrac
path, query, fragment = formatter.split_link(path)
else:
assert ns in ("log", "log2")
if ns == "log":
match, query, fragment = formatter.split_link(match)
else:
query = fragment = ""
match = "".join(reversed(match.split("/", 1)))
path = match
revs = ""
if self.LOG_LINK_RE.match(match):
indexes = [sep in match and match.index(sep) for sep in ":@"]
idx = min([i for i in indexes if i is not False])
path, revs = match[:idx], match[idx + 1 :]
rm = RepositoryManager(self.env)
try:
reponame, repos, path = rm.get_repository_by_path(path)
if not reponame:
reponame = rm.get_default_repository(formatter.context)
if reponame is not None:
repos = rm.get_repository(reponame)
if repos:
if "LOG_VIEW" in formatter.perm:
reponame = repos.reponame or None
path = path or "/"
revranges = RevRanges(repos, revs)
if revranges.has_ranges():
href = formatter.href.log(reponame, path, revs=unicode(revranges))
else:
# try to resolve if single rev
repos.normalize_rev(revs)
href = formatter.href.log(reponame, path, rev=revs or None)
if query and "?" in href:
query = "&" + query[1:]
return tag.a(label, class_="source", href=href + query + fragment)
errmsg = _("No permission to view change log")
elif reponame:
errmsg = _("Repository '%(repo)s' not found", repo=reponame)
else:
errmsg = _("No default repository defined")
except TracError as e:
errmsg = to_unicode(e)
return tag.a(label, class_="missing source", title=errmsg)
示例6: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
req.perm.require('BROWSER_VIEW')
presel = req.args.get('preselected')
if presel and (presel + '/').startswith(req.href.browser() + '/'):
req.redirect(presel)
path = req.args.get('path', '/')
rev = req.args.get('rev', '')
if rev in ('', 'HEAD'):
rev = None
order = req.args.get('order', 'name').lower()
desc = req.args.has_key('desc')
xhr = req.get_header('X-Requested-With') == 'XMLHttpRequest'
rm = RepositoryManager(self.env)
all_repositories = rm.get_all_repositories()
reponame, repos, path = rm.get_repository_by_path(path)
# Repository index
show_index = not reponame and path == '/'
if show_index:
if repos and (as_bool(all_repositories[''].get('hidden'))
or not repos.can_view(req.perm)):
repos = None
if not repos and reponame:
raise ResourceNotFound(_("Repository '%(repo)s' not found",
repo=reponame))
if reponame and reponame != repos.reponame: # Redirect alias
qs = req.query_string
req.redirect(req.href.browser(repos.reponame or None, path)
+ (qs and '?' + qs or ''))
reponame = repos and repos.reponame or None
# Find node for the requested path/rev
context = Context.from_request(req)
node = None
display_rev = lambda rev: rev
if repos:
try:
if rev:
rev = repos.normalize_rev(rev)
# If `rev` is `None`, we'll try to reuse `None` consistently,
# as a special shortcut to the latest revision.
rev_or_latest = rev or repos.youngest_rev
node = get_existing_node(req, repos, path, rev_or_latest)
except NoSuchChangeset, e:
raise ResourceNotFound(e.message,
_('Invalid changeset number'))
context = context(repos.resource.child('source', path,
version=rev_or_latest))
display_rev = repos.display_rev
示例7: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
rev = req.args.get("rev")
path = req.args.get("path")
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
gh_repo = self.get_gh_repo(reponame)
try:
rev = repos.normalize_rev(rev)
except NoSuchChangeset, e:
raise ResourceNotFound(e.message, _("Invalid Changeset Number"))
示例8: _get_link_info
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _get_link_info(self, path, rev, href, perm):
rm = RepositoryManager(self.env)
node = raw_href = title = None
try:
reponame, repos, npath = rm.get_repository_by_path(path)
node = get_allowed_node(repos, npath, rev, perm)
if node is not None:
raw_href = self._get_download_href(href, repos, node, rev)
title = _("Download") if node.isfile else _("Download as Zip archive")
except TracError:
pass
return (node, raw_href, title)
示例9: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
if req.method != 'POST':
msg = u'Method not allowed (%s)\n' % req.method
self.log.warning(msg.rstrip('\n'))
req.send(msg.encode('utf-8'), 'text/plain', 405)
path = req.args['path']
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
if path != '/':
msg = u'No such repository (%s)\n' % path
self.log.warning(msg.rstrip('\n'))
req.send(msg.encode('utf-8'), 'text/plain', 400)
output = u'Running hook on %s\n' % (reponame or '(default)')
output += u'* Updating clone\n'
repos.git.repo.remote('update', '--prune')
output += u'* Synchronizing with clone\n'
repos.git.sync()
try:
payload = json.loads(req.args['payload'])
revs = [commit['id']
for commit in payload['commits'] if commit['distinct']]
except (ValueError, KeyError):
msg = u'Invalid payload\n'
self.log.warning(msg.rstrip('\n'))
req.send(msg.encode('utf-8'), 'text/plain', 400)
branches = self.get_branches(reponame)
added, skipped, unknown = classify_commits(revs, repos, branches)
if added:
output += u'* Adding %s\n' % describe_commits(added)
# This is where Trac gets notified of the commits in the changeset
rm.notify('changeset_added', reponame, added)
if skipped:
output += u'* Skipping %s\n' % describe_commits(skipped)
if unknown:
output += u'* Unknown %s\n' % describe_commits(unknown)
self.log.error(u'Payload contains unknown %s',
describe_commits(unknown))
for line in output.splitlines():
self.log.debug(line)
req.send(output.encode('utf-8'), 'text/plain', 200 if output else 204)
示例10: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
if not self.repository: # pragma: no cover
return super(GitHubBrowser, self).process_request(req)
rev = req.args.get('rev')
path = req.args.get('path')
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
key = 'repository' if is_default(reponame) else '%s.repository' % reponame
gh_repo = self.config.get('github', key)
try:
rev = repos.normalize_rev(rev)
except NoSuchChangeset, e:
raise ResourceNotFound(e.message, _('Invalid Changeset Number'))
示例11: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
rev = req.args.get('rev')
path = req.args.get('path')
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
gh_repo = self.get_gh_repo(reponame)
rev = repos.normalize_rev(rev)
if path and path != '/':
path = path.lstrip('/')
# GitHub will s/blob/tree/ if the path is a directory
url = 'https://github.com/%s/blob/%s/%s' % (gh_repo, rev, path)
else:
url = 'https://github.com/%s/commit/%s' % (gh_repo, rev)
req.redirect(url)
示例12: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
req.perm.require('LOG_VIEW')
mode = req.args.get('mode', 'stop_on_copy')
path = req.args.get('path', '/')
rev = req.args.get('rev')
stop_rev = req.args.get('stop_rev')
revs = req.args.get('revs')
format = req.args.get('format')
verbose = req.args.get('verbose')
limit = int(req.args.get('limit') or self.default_log_limit)
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
if not repos:
raise ResourceNotFound(_("Repository '%(repo)s' not found",
repo=reponame))
if reponame != repos.reponame: # Redirect alias
qs = req.query_string
req.redirect(req.href.log(repos.reponame or None, path)
+ ('?' + qs if qs else ''))
normpath = repos.normalize_path(path)
# if `revs` parameter is given, then we're restricted to the
# corresponding revision ranges.
# If not, then we're considering all revisions since `rev`,
# on that path, in which case `revranges` will be None.
revranges = None
if revs:
try:
revranges = Ranges(revs)
rev = revranges.b
except ValueError:
pass
rev = unicode(repos.normalize_rev(rev))
display_rev = repos.display_rev
# The `history()` method depends on the mode:
# * for ''stop on copy'' and ''follow copies'', it's `Node.history()`
# unless explicit ranges have been specified
# * for ''show only add, delete'' we're using
# `Repository.get_path_history()`
cset_resource = repos.resource.child('changeset')
show_graph = False
if mode == 'path_history':
def history():
for h in repos.get_path_history(path, rev):
if 'CHANGESET_VIEW' in req.perm(cset_resource(id=h[1])):
yield h
elif revranges:
def history():
prevpath = path
expected_next_item = None
ranges = list(revranges.pairs)
ranges.reverse()
for (a, b) in ranges:
a = repos.normalize_rev(a)
b = repos.normalize_rev(b)
while not repos.rev_older_than(b, a):
node = get_existing_node(req, repos, prevpath, b)
node_history = list(node.get_history(2))
p, rev, chg = node_history[0]
if repos.rev_older_than(rev, a):
break # simply skip, no separator
if 'CHANGESET_VIEW' in req.perm(cset_resource(id=rev)):
if expected_next_item:
# check whether we're continuing previous range
np, nrev, nchg = expected_next_item
if rev != nrev: # no, we need a separator
yield (np, nrev, None)
yield node_history[0]
prevpath = node_history[-1][0] # follow copy
b = repos.previous_rev(rev)
if len(node_history) > 1:
expected_next_item = node_history[-1]
else:
expected_next_item = None
if expected_next_item:
yield (expected_next_item[0], expected_next_item[1], None)
else:
show_graph = path == '/' and not verbose \
and not repos.has_linear_changesets
def history():
node = get_existing_node(req, repos, path, rev)
for h in node.get_history():
if 'CHANGESET_VIEW' in req.perm(cset_resource(id=h[1])):
yield h
# -- retrieve history, asking for limit+1 results
info = []
depth = 1
previous_path = normpath
count = 0
for old_path, old_rev, old_chg in history():
if stop_rev and repos.rev_older_than(old_rev, stop_rev):
break
old_path = repos.normalize_path(old_path)
#.........这里部分代码省略.........
示例13: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
req.perm.require("LOG_VIEW")
mode = req.args.get("mode", "stop_on_copy")
path = req.args.get("path", "/")
rev = req.args.get("rev")
stop_rev = req.args.get("stop_rev")
revs = req.args.get("revs")
format = req.args.get("format")
verbose = req.args.get("verbose")
limit = int(req.args.get("limit") or self.default_log_limit)
rm = RepositoryManager(self.env)
reponame, repos, path = rm.get_repository_by_path(path)
if not repos:
if path == "/":
raise TracError(_("No repository specified and no default" " repository configured."))
else:
raise ResourceNotFound(_("Repository '%(repo)s' not found", repo=reponame or path.strip("/")))
if reponame != repos.reponame: # Redirect alias
qs = req.query_string
req.redirect(req.href.log(repos.reponame or None, path) + ("?" + qs if qs else ""))
normpath = repos.normalize_path(path)
# if `revs` parameter is given, then we're restricted to the
# corresponding revision ranges.
# If not, then we're considering all revisions since `rev`,
# on that path, in which case `revranges` will be None.
if revs:
revranges = RevRanges(repos, revs, resolve=True)
rev = revranges.b
else:
revranges = None
rev = repos.normalize_rev(rev)
# The `history()` method depends on the mode:
# * for ''stop on copy'' and ''follow copies'', it's `Node.history()`
# unless explicit ranges have been specified
# * for ''show only add, delete'' we're using
# `Repository.get_path_history()`
cset_resource = repos.resource.child(self.realm)
show_graph = False
curr_revrange = []
if mode == "path_history":
def history():
for h in repos.get_path_history(path, rev):
if "CHANGESET_VIEW" in req.perm(cset_resource(id=h[1])):
yield h
elif revranges:
show_graph = path == "/" and not verbose and not repos.has_linear_changesets and len(revranges) == 1
def history():
separator = False
for a, b in reversed(revranges.pairs):
curr_revrange[:] = (a, b)
node = get_existing_node(req, repos, path, b)
for p, rev, chg in node.get_history():
if repos.rev_older_than(rev, a):
break
if "CHANGESET_VIEW" in req.perm(cset_resource(id=rev)):
separator = True
yield p, rev, chg
else:
separator = False
if separator:
yield p, rev, None
else:
show_graph = path == "/" and not verbose and not repos.has_linear_changesets
def history():
node = get_existing_node(req, repos, path, rev)
for h in node.get_history():
if "CHANGESET_VIEW" in req.perm(cset_resource(id=h[1])):
yield h
# -- retrieve history, asking for limit+1 results
info = []
depth = 1
previous_path = normpath
count = 0
history_remaining = True
for old_path, old_rev, old_chg in history():
if stop_rev and repos.rev_older_than(old_rev, stop_rev):
break
old_path = repos.normalize_path(old_path)
item = {"path": old_path, "rev": old_rev, "existing_rev": old_rev, "change": old_chg, "depth": depth}
if old_chg == Changeset.DELETE:
item["existing_rev"] = repos.previous_rev(old_rev, old_path)
if not (mode == "path_history" and old_chg == Changeset.EDIT):
info.append(item)
if old_path and old_path != previous_path and not (mode == "path_history" and old_path == normpath):
depth += 1
#.........这里部分代码省略.........
示例14: process_request
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def process_request(self, req):
presel = req.args.get("preselected")
if presel and (presel + "/").startswith(req.href.browser() + "/"):
req.redirect(presel)
path = req.args.get("path", "/")
rev = req.args.get("rev", "")
if rev.lower() in ("", "head"):
rev = None
format = req.args.get("format")
order = req.args.get("order", "name").lower()
desc = "desc" in req.args
rm = RepositoryManager(self.env)
all_repositories = rm.get_all_repositories()
reponame, repos, path = rm.get_repository_by_path(path)
# Repository index
show_index = not reponame and path == "/"
if show_index:
if repos and (as_bool(all_repositories[""].get("hidden")) or not repos.is_viewable(req.perm)):
repos = None
if not repos and reponame:
raise ResourceNotFound(_("Repository '%(repo)s' not found", repo=reponame))
if reponame and reponame != repos.reponame: # Redirect alias
qs = req.query_string
req.redirect(req.href.browser(repos.reponame or None, path) + ("?" + qs if qs else ""))
reponame = repos.reponame if repos else None
# Find node for the requested path/rev
context = web_context(req)
node = None
changeset = None
display_rev = lambda rev: rev
if repos:
try:
if rev:
rev = repos.normalize_rev(rev)
# If `rev` is `None`, we'll try to reuse `None` consistently,
# as a special shortcut to the latest revision.
rev_or_latest = rev or repos.youngest_rev
node = get_existing_node(req, repos, path, rev_or_latest)
except NoSuchChangeset as e:
raise ResourceNotFound(e, _("Invalid changeset number"))
if node:
try:
# use changeset instance to retrieve branches and tags
changeset = repos.get_changeset(node.rev)
except NoSuchChangeset:
pass
context = context.child(repos.resource.child(self.realm, path, version=rev_or_latest))
display_rev = repos.display_rev
# Prepare template data
path_links = get_path_links(req.href, reponame, path, rev, order, desc)
repo_data = dir_data = file_data = None
if show_index:
repo_data = self._render_repository_index(context, all_repositories, order, desc)
if node:
if not node.is_viewable(req.perm):
raise PermissionError("BROWSER_VIEW" if node.isdir else "FILE_VIEW", node.resource, self.env)
if node.isdir:
if format in ("zip",): # extension point here...
self._render_zip(req, context, repos, node, rev)
# not reached
dir_data = self._render_dir(req, repos, node, rev, order, desc)
elif node.isfile:
file_data = self._render_file(req, context, repos, node, rev)
if not repos and not (repo_data and repo_data["repositories"]):
# If no viewable repositories, check permission instead of
# repos.is_viewable()
req.perm.require("BROWSER_VIEW")
if show_index:
raise ResourceNotFound(_("No viewable repositories"))
else:
raise ResourceNotFound(_("No node %(path)s", path=path))
quickjump_data = properties_data = None
if node and not req.is_xhr:
properties_data = self.render_properties("browser", context, node.get_properties())
quickjump_data = list(repos.get_quickjump_entries(rev))
data = {
"context": context,
"reponame": reponame,
"repos": repos,
"repoinfo": all_repositories.get(reponame or ""),
"path": path,
"rev": node and node.rev,
"stickyrev": rev,
"display_rev": display_rev,
"changeset": changeset,
"created_path": node and node.created_path,
"created_rev": node and node.created_rev,
"properties": properties_data,
#.........这里部分代码省略.........
示例15: _read_source_from_repos
# 需要导入模块: from trac.versioncontrol.api import RepositoryManager [as 别名]
# 或者: from trac.versioncontrol.api.RepositoryManager import get_repository_by_path [as 别名]
def _read_source_from_repos(self, formatter, src_path):
repos_mgr = RepositoryManager(self.env)
try: #0.12+
repos_name, repos, source_obj = repos_mgr.get_repository_by_path(src_path)
except AttributeError, e: #0.11
repos = repos_mgr.get_repository(formatter.req.authname)