OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 Google Inc. | 2 # Copyright 2014 Google Inc. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 | 7 |
8 """Parse a DEPS file and git checkout all of the dependencies. | 8 """Parse a DEPS file and git checkout all of the dependencies. |
9 | 9 |
10 Args: | 10 Args: |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 Args: | 70 Args: |
71 git (string) the git executable | 71 git (string) the git executable |
72 | 72 |
73 directory (string) the path into which the repository | 73 directory (string) the path into which the repository |
74 is expected to be checked out. | 74 is expected to be checked out. |
75 """ | 75 """ |
76 try: | 76 try: |
77 toplevel = subprocess.check_output( | 77 toplevel = subprocess.check_output( |
78 [git, 'rev-parse', '--show-toplevel'], cwd=directory).strip() | 78 [git, 'rev-parse', '--show-toplevel'], cwd=directory).strip() |
79 return os.path.abspath(directory) == os.path.abspath(toplevel) | 79 return os.path.realpath(directory) == os.path.realpath(toplevel) |
80 except subprocess.CalledProcessError: | 80 except subprocess.CalledProcessError: |
81 return False | 81 return False |
82 | 82 |
83 | 83 |
84 def git_checkout_to_directory(git, repo, checkoutable, directory, verbose): | 84 def git_checkout_to_directory(git, repo, checkoutable, directory, verbose): |
85 """Checkout (and clone if needed) a Git repository. | 85 """Checkout (and clone if needed) a Git repository. |
86 | 86 |
87 Args: | 87 Args: |
88 git (string) the git executable | 88 git (string) the git executable |
89 | 89 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 try: | 196 try: |
197 git_sync_deps(deps_file_path, argv, verbose) | 197 git_sync_deps(deps_file_path, argv, verbose) |
198 return 0 | 198 return 0 |
199 except DepsError: | 199 except DepsError: |
200 usage(deps_file_path) | 200 usage(deps_file_path) |
201 return 1 | 201 return 1 |
202 | 202 |
203 | 203 |
204 if __name__ == '__main__': | 204 if __name__ == '__main__': |
205 exit(main(sys.argv[1:])) | 205 exit(main(sys.argv[1:])) |
OLD | NEW |