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

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: rebase, address comment, remove unused var 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
« git_cl.py ('K') | « 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 0bf57499e738d0781da76551f75363dbe46d1fed..13eb343181b9a667b90072f29e56121860fdd838 100755
--- a/git_map_branches.py
+++ b/git_map_branches.py
@@ -116,10 +116,25 @@ class BranchMapper(object):
self.__current_branch = None
self.__current_hash = None
self.__tag_set = None
+ self.__status_info = None
iannucci 2015/03/03 01:00:14 why not default to `{}`?
calamity 2015/03/03 04:58:12 Done.
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 = {}
iannucci 2015/03/03 01:00:14 then you can skip this
calamity 2015/03/03 04:58:12 Done.
+ status_info = get_cl_statuses(self.__branches_info.keys(),
+ self.verbosity == 2)
+
+ for _ in xrange(len(self.__branches_info)):
+ # This is a blocking get which waits for the remote CL status to be
+ # retrieved.
+ (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 +252,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:
iannucci 2015/03/03 01:00:14 and this would still work, but in general you woul
calamity 2015/03/03 04:58:12 Reverted to a verbosity check.
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)
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698