| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 | 6 | 
| 7 """Wrapper for updating and calling infra.git tools. | 7 """Wrapper for updating and calling infra.git tools. | 
| 8 | 8 | 
| 9 This tool does a two things: | 9 This tool does a two things: | 
| 10 * Maintains a infra.git checkout pinned at "deployed" in the home dir | 10 * Maintains a infra.git checkout pinned at "deployed" in the home dir | 
| 11 * Acts as an alias to infra.tools.* | 11 * Acts as an alias to infra.tools.* | 
| 12 """ | 12 """ | 
| 13 | 13 | 
| 14 # TODO(hinoka): Use cipd/glyco instead of git/gclient. | 14 # TODO(hinoka): Use cipd/glyco instead of git/gclient. | 
| 15 | 15 | 
| 16 import argparse | 16 import argparse | 
| 17 import sys | 17 import sys | 
| 18 import os | 18 import os | 
| 19 import subprocess | 19 import subprocess | 
| 20 import re | 20 import re | 
| 21 | 21 | 
| 22 | 22 | 
| 23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 
| 24 GCLIENT = os.path.join(SCRIPT_DIR, 'gclient.py') | 24 GCLIENT = os.path.join(SCRIPT_DIR, 'gclient.py') | 
| 25 TARGET_DIR = os.path.expanduser('~/.chrome-infra') | 25 TARGET_DIR = os.path.expanduser(os.path.join('~', '.chrome-infra')) | 
| 26 INFRA_DIR = os.path.join(TARGET_DIR, 'infra') | 26 INFRA_DIR = os.path.join(TARGET_DIR, 'infra') | 
| 27 | 27 | 
| 28 | 28 | 
| 29 def get_git_rev(target, branch): | 29 def get_git_rev(target, branch): | 
| 30   return subprocess.check_output( | 30   return subprocess.check_output( | 
| 31       ['git', 'log', '--format=%B', '-n1', branch], cwd=target) | 31       ['git', 'log', '--format=%B', '-n1', branch], cwd=target) | 
| 32 | 32 | 
| 33 | 33 | 
| 34 def need_to_update(branch): | 34 def need_to_update(branch): | 
| 35   """Checks to see if we need to update the ~/.chrome-infra/infra checkout.""" | 35   """Checks to see if we need to update the ~/.chrome-infra/infra checkout.""" | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 111     args.args.pop(0) | 111     args.args.pop(0) | 
| 112   if extras: | 112   if extras: | 
| 113     args.args = extras + args.args | 113     args.args = extras + args.args | 
| 114 | 114 | 
| 115   if need_to_update(args.infra_branch): | 115   if need_to_update(args.infra_branch): | 
| 116     ensure_infra(args.infra_branch) | 116     ensure_infra(args.infra_branch) | 
| 117   return run(args.args) | 117   return run(args.args) | 
| 118 | 118 | 
| 119 if __name__ == '__main__': | 119 if __name__ == '__main__': | 
| 120   sys.exit(main()) | 120   sys.exit(main()) | 
| OLD | NEW | 
|---|