OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Provides a short mapping of all the branches in your local repo, organized | 6 """Provides a short mapping of all the branches in your local repo, organized |
7 by their upstream ('tracking branch') layout. | 7 by their upstream ('tracking branch') layout. |
8 | 8 |
9 Example: | 9 Example: |
10 origin/master | 10 origin/master |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 # Avoid heavy import unless necessary. | 130 # Avoid heavy import unless necessary. |
131 from git_cl import get_cl_statuses, color_for_status | 131 from git_cl import get_cl_statuses, color_for_status |
132 | 132 |
133 status_info = get_cl_statuses(self.__branches_info.keys(), | 133 status_info = get_cl_statuses(self.__branches_info.keys(), |
134 fine_grained=self.verbosity > 2, | 134 fine_grained=self.verbosity > 2, |
135 max_processes=self.maxjobs) | 135 max_processes=self.maxjobs) |
136 | 136 |
137 for _ in xrange(len(self.__branches_info)): | 137 for _ in xrange(len(self.__branches_info)): |
138 # This is a blocking get which waits for the remote CL status to be | 138 # This is a blocking get which waits for the remote CL status to be |
139 # retrieved. | 139 # retrieved. |
140 (branch, url, status) = status_info.next() | 140 (cl, status) = status_info.next() |
141 self.__status_info[branch] = (url, color_for_status(status)) | 141 self.__status_info[cl.GetBranchRef()] = (cl.GetIssueURL(), |
tandrii(chromium)
2016/04/26 09:49:51
It used to be called 'branch' not branchref. Are y
| |
142 color_for_status(status)) | |
142 | 143 |
143 roots = set() | 144 roots = set() |
144 | 145 |
145 # A map of parents to a list of their children. | 146 # A map of parents to a list of their children. |
146 for branch, branch_info in self.__branches_info.iteritems(): | 147 for branch, branch_info in self.__branches_info.iteritems(): |
147 if not branch_info: | 148 if not branch_info: |
148 continue | 149 continue |
149 | 150 |
150 parent = branch_info.upstream | 151 parent = branch_info.upstream |
151 if not self.__branches_info[parent]: | 152 if not self.__branches_info[parent]: |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 mapper.start() | 304 mapper.start() |
304 print mapper.output.as_formatted_string() | 305 print mapper.output.as_formatted_string() |
305 return 0 | 306 return 0 |
306 | 307 |
307 if __name__ == '__main__': | 308 if __name__ == '__main__': |
308 try: | 309 try: |
309 sys.exit(main(sys.argv[1:])) | 310 sys.exit(main(sys.argv[1:])) |
310 except KeyboardInterrupt: | 311 except KeyboardInterrupt: |
311 sys.stderr.write('interrupted\n') | 312 sys.stderr.write('interrupted\n') |
312 sys.exit(1) | 313 sys.exit(1) |
OLD | NEW |