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