summaryrefslogtreecommitdiff
path: root/gbp/git/repository.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-12-03 10:21:43 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-06-05 14:20:07 +0300
commit843d9a4df81624a4db619069587adb678535a48d (patch)
tree8582d11b16e5d04c9de723b86832988e8fb59d16 /gbp/git/repository.py
parentb1c4e6b136598dd08a06e3e8a6529577772f8ecf (diff)
downloadgit-buildpackage-843d9a4df81624a4db619069587adb678535a48d.tar.gz
git-buildpackage-843d9a4df81624a4db619069587adb678535a48d.tar.bz2
git-buildpackage-843d9a4df81624a4db619069587adb678535a48d.zip
GitRepository/get_remote_repos: return URLs, too
In addition to the remote name, return remote URLs. Return value is now a dict with remote name as the key and a list of URLs as the value. The first value in the list is the effective fetch URL, the rest of the values are push URLs. NOTE! This patch is to be dropped, not going for upstream. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r--gbp/git/repository.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 04ba849a..cd779152 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1187,10 +1187,25 @@ class GitRepository(object):
@deprecated: Use get_remotes() instead
@return: remote repositories
- @rtype: C{list} of C{str}
+ @rtype: C{dict} of C{list} of C{str}
"""
- out = self._git_getoutput('remote')[0]
- return [ remote.strip() for remote in out ]
+ stdout, stderr, ret = self._git_inout('remote', ['-v'],
+ capture_stderr=True)
+ if ret:
+ raise GitRepositoryError('Failed to get remotes: %s' % stderr)
+
+ remotes = {}
+ for rem in stdout.splitlines():
+ name, url_urltype = rem.split('\t', 1)
+ url, urltype = url_urltype.rsplit(' ', 1)
+ urltype = urltype.strip('()')
+ if not name in remotes:
+ remotes[name] = ['']
+ if urltype == 'fetch':
+ remotes[name][0] = url
+ else:
+ remotes[name].append(url)
+ return remotes
def has_remote_repo(self, name):
"""