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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 line.append(back_separator) | 259 line.append(back_separator) |
260 | 260 |
261 # The Rietveld issue associated with the branch. | 261 # The Rietveld issue associated with the branch. |
262 if self.verbosity >= 2: | 262 if self.verbosity >= 2: |
263 (url, color) = ('', '') if self.__is_invalid_parent(branch) \ | 263 (url, color) = ('', '') if self.__is_invalid_parent(branch) \ |
264 else self.__status_info[branch] | 264 else self.__status_info[branch] |
265 line.append(url or '', color=color) | 265 line.append(url or '', color=color) |
266 | 266 |
267 # The subject of the most recent commit on the branch. | 267 # The subject of the most recent commit on the branch. |
268 if self.show_subject: | 268 if self.show_subject: |
269 line.append(run('log', '-n1', '--format=%s', branch)) | 269 line.append(run('log', '-n1', '--format=%s', branch, '--')) |
270 | 270 |
271 self.output.append(line) | 271 self.output.append(line) |
272 | 272 |
273 for child in sorted(self.__parent_map.pop(branch, ())): | 273 for child in sorted(self.__parent_map.pop(branch, ())): |
274 self.__append_branch(child, depth=depth + 1) | 274 self.__append_branch(child, depth=depth + 1) |
275 | 275 |
276 | 276 |
277 def main(argv): | 277 def main(argv): |
278 setup_color.init() | 278 setup_color.init() |
279 if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION: | 279 if get_git_version() < MIN_UPSTREAM_TRACK_GIT_VERSION: |
(...skipping 25 matching lines...) Expand all Loading... |
305 mapper.start() | 305 mapper.start() |
306 print mapper.output.as_formatted_string() | 306 print mapper.output.as_formatted_string() |
307 return 0 | 307 return 0 |
308 | 308 |
309 if __name__ == '__main__': | 309 if __name__ == '__main__': |
310 try: | 310 try: |
311 sys.exit(main(sys.argv[1:])) | 311 sys.exit(main(sys.argv[1:])) |
312 except KeyboardInterrupt: | 312 except KeyboardInterrupt: |
313 sys.stderr.write('interrupted\n') | 313 sys.stderr.write('interrupted\n') |
314 sys.exit(1) | 314 sys.exit(1) |
OLD | NEW |