Check presence of repo address also.
BUG:FIXED:5940
This commit is contained in:
@@ -583,6 +583,9 @@ def add_repo(name, indexuri, at = None):
|
|||||||
repodb = pisi.db.repodb.RepoDB()
|
repodb = pisi.db.repodb.RepoDB()
|
||||||
if repodb.has_repo(name):
|
if repodb.has_repo(name):
|
||||||
raise pisi.Error(_('Repo %s already present.') % name)
|
raise pisi.Error(_('Repo %s already present.') % name)
|
||||||
|
elif repodb.has_repo_url(indexuri):
|
||||||
|
repo = repodb.get_repo_by_url(indexuri)
|
||||||
|
raise pisi.Error(_('Repo already present with name %s.') % repo)
|
||||||
else:
|
else:
|
||||||
repo = pisi.db.repodb.Repo(pisi.uri.URI(indexuri))
|
repo = pisi.db.repodb.Repo(pisi.uri.URI(indexuri))
|
||||||
repodb.add_repo(name, repo, at = at)
|
repodb.add_repo(name, repo, at = at)
|
||||||
|
|||||||
@@ -166,3 +166,11 @@ class RepoDB(lazydb.LazyDB):
|
|||||||
for r in self.list_repos():
|
for r in self.list_repos():
|
||||||
repos.append(self.get_repo_url(r))
|
repos.append(self.get_repo_url(r))
|
||||||
return repos
|
return repos
|
||||||
|
|
||||||
|
def get_repo_by_url(self, url):
|
||||||
|
if not self.has_repo_url(url):
|
||||||
|
return None
|
||||||
|
|
||||||
|
for r in self.list_repos():
|
||||||
|
if self.get_repo_url(r) == url:
|
||||||
|
return r
|
||||||
|
|||||||
Reference in New Issue
Block a user