Commit 937159d6 authored by szager@chromium.org's avatar szager@chromium.org

Fix logic for determing remote name from remote branch.

BUG=413391
R=iannucci@chromium.org,agable@chromium.org

Review URL: https://codereview.chromium.org/567873002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292117 0039d316-1c4b-4281-b951-d872f2087c98
parent c137c1a5
...@@ -13,6 +13,7 @@ import logging ...@@ -13,6 +13,7 @@ import logging
import sys import sys
import textwrap import textwrap
from fnmatch import fnmatch
from pprint import pformat from pprint import pformat
import git_common as git import git_common as git
...@@ -41,15 +42,23 @@ def fetch_remotes(branch_tree): ...@@ -41,15 +42,23 @@ def fetch_remotes(branch_tree):
fetch_tags = False fetch_tags = False
remotes = set() remotes = set()
tag_set = git.tags() tag_set = git.tags()
fetchspec_map = {}
all_fetchspec_configs = git.run(
'config', '--get-regexp', r'remote\..*\.fetch').strip()
for fetchspec_config in all_fetchspec_configs.splitlines():
key, _, fetchspec = fetchspec_config.partition(' ')
dest_spec = fetchspec.partition(':')[2]
remote_name = key.split('.')[1]
fetchspec_map[dest_spec] = remote_name
for parent in branch_tree.itervalues(): for parent in branch_tree.itervalues():
if parent in tag_set: if parent in tag_set:
fetch_tags = True fetch_tags = True
else: else:
full_ref = git.run('rev-parse', '--symbolic-full-name', parent) full_ref = git.run('rev-parse', '--symbolic-full-name', parent)
if full_ref.startswith('refs/remotes'): for dest_spec, remote_name in fetchspec_map.iteritems():
parts = full_ref.split('/') if fnmatch(full_ref, dest_spec):
remote_name = parts[2] remotes.add(remote_name)
remotes.add(remote_name) break
fetch_args = [] fetch_args = []
if fetch_tags: if fetch_tags:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment