Chromium Code Reviews| 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) |