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

Unified Diff: git_map_branches.py

Issue 938583002: Make git-map-branches -vvv show CL status colors. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 10 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 | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_map_branches.py
diff --git a/git_map_branches.py b/git_map_branches.py
index 44f13c3bd5abc010269e48d05d6d82a7374ddf65..456e13b62c1c32d3d1279219698ba93620697896 100755
--- a/git_map_branches.py
+++ b/git_map_branches.py
@@ -116,10 +116,24 @@ class BranchMapper(object):
self.__current_branch = None
self.__current_hash = None
self.__tag_set = None
+ self.__status_info = None
def start(self):
self.__branches_info = get_branches_info(
include_tracking_status=self.verbosity >= 1)
+ if (self.verbosity >= 2):
+ # Avoid heavy import unless necessary.
+ from git_cl import get_cl_statuses
+
+ self.__status_info = {}
+ status_info = get_cl_statuses(self.__branches_info.keys(),
+ self.verbosity == 2)
+
+ threads_left = len(self.__branches_info)
jsbell 2015/02/27 17:39:38 Maybe `queue_length` or `branch_count` instead of
calamity 2015/03/02 02:35:03 Done.
+ for i in xrange(threads_left):
+ (branch, url, color) = status_info.get()
+ self.__status_info[branch] = (url, color);
+
roots = set()
# A map of parents to a list of their children.
@@ -237,12 +251,10 @@ class BranchMapper(object):
line.append(back_separator)
# The Rietveld issue associated with the branch.
- if self.verbosity >= 2:
- import git_cl # avoid heavy import cost unless we need it
+ if self.__status_info:
none_text = '' if self.__is_invalid_parent(branch) else 'None'
- url = git_cl.Changelist(
- branchref=branch).GetIssueURL() if branch_hash else None
- line.append(url or none_text, color=Fore.BLUE if url else Fore.WHITE)
+ (url, color) = self.__status_info[branch]
+ line.append(url or none_text, color=color)
self.output.append(line)
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698