Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: git_rebase_update.py

Issue 567873002: Fix logic for determing remote name from remote branch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: nits Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_rebase_update.py
diff --git a/git_rebase_update.py b/git_rebase_update.py
index 09eaffa0f8a5da76a58b5d46bc5a13ecaf844e30..e5b6d424735c35c240ed1a9fa038070c3fa39b45 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -13,6 +13,7 @@ import logging
import sys
import textwrap
+from fnmatch import fnmatch
from pprint import pformat
import git_common as git
@@ -41,15 +42,23 @@ def fetch_remotes(branch_tree):
fetch_tags = False
remotes = set()
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():
if parent in tag_set:
fetch_tags = True
else:
full_ref = git.run('rev-parse', '--symbolic-full-name', parent)
- if full_ref.startswith('refs/remotes'):
- parts = full_ref.split('/')
- remote_name = parts[2]
- remotes.add(remote_name)
+ for dest_spec, remote_name in fetchspec_map.iteritems():
+ if fnmatch(full_ref, dest_spec):
+ remotes.add(remote_name)
+ break
fetch_args = []
if fetch_tags:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698