| 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 '.'.join(str(x) for x in MIN_UPSTREAM_TRACK_GIT_VERSION) + | 259 '.'.join(str(x) for x in MIN_UPSTREAM_TRACK_GIT_VERSION) + |
| 260 '. Please consider upgrading.') | 260 '. Please consider upgrading.') |
| 261 | 261 |
| 262 parser = argparse.ArgumentParser( | 262 parser = argparse.ArgumentParser( |
| 263 description='Print a a tree of all branches parented by their upstreams') | 263 description='Print a a tree of all branches parented by their upstreams') |
| 264 parser.add_argument('-v', action='count', | 264 parser.add_argument('-v', action='count', |
| 265 help='Display branch hash and Rietveld URL') | 265 help='Display branch hash and Rietveld URL') |
| 266 parser.add_argument('--no-color', action='store_true', dest='nocolor', | 266 parser.add_argument('--no-color', action='store_true', dest='nocolor', |
| 267 help='Turn off colors.') | 267 help='Turn off colors.') |
| 268 | 268 |
| 269 opts = parser.parse_args(argv[1:]) | 269 opts = parser.parse_args(argv) |
| 270 | 270 |
| 271 mapper = BranchMapper() | 271 mapper = BranchMapper() |
| 272 mapper.verbosity = opts.v | 272 mapper.verbosity = opts.v |
| 273 mapper.output.nocolor = opts.nocolor | 273 mapper.output.nocolor = opts.nocolor |
| 274 mapper.start() | 274 mapper.start() |
| 275 print mapper.output.as_formatted_string() | 275 print mapper.output.as_formatted_string() |
| 276 return 0 |
| 276 | 277 |
| 277 if __name__ == '__main__': | 278 if __name__ == '__main__': |
| 278 sys.exit(main(sys.argv)) | 279 try: |
| 280 sys.exit(main(sys.argv[1:])) |
| 281 except KeyboardInterrupt: |
| 282 sys.stderr.write('interrupted\n') |
| 283 sys.exit(1) |
| OLD | NEW |