| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Meta checkout manager supporting both Subversion and GIT.""" | 6 """Meta checkout manager supporting both Subversion and GIT.""" |
| 7 # Files | 7 # Files |
| 8 # .gclient : Current client configuration, written by 'config' command. | 8 # .gclient : Current client configuration, written by 'config' command. |
| 9 # Format is a Python script defining 'solutions', a list whose | 9 # Format is a Python script defining 'solutions', a list whose |
| 10 # entries each are maps binding the strings "name" and "url" | 10 # entries each are maps binding the strings "name" and "url" |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 # Parse the dependencies of this dependency. | 696 # Parse the dependencies of this dependency. |
| 697 for s in self.dependencies: | 697 for s in self.dependencies: |
| 698 work_queue.enqueue(s) | 698 work_queue.enqueue(s) |
| 699 | 699 |
| 700 if command == 'recurse': | 700 if command == 'recurse': |
| 701 if not isinstance(parsed_url, self.FileImpl): | 701 if not isinstance(parsed_url, self.FileImpl): |
| 702 # Skip file only checkout. | 702 # Skip file only checkout. |
| 703 scm = gclient_scm.GetScmName(parsed_url) | 703 scm = gclient_scm.GetScmName(parsed_url) |
| 704 if not options.scm or scm in options.scm: | 704 if not options.scm or scm in options.scm: |
| 705 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) | 705 cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) |
| 706 # Pass in the SCM type as an env variable | 706 # Pass in the SCM type as an env variable. Make sure we don't put |
| 707 # unicode strings in the environment. |
| 707 env = os.environ.copy() | 708 env = os.environ.copy() |
| 708 if scm: | 709 if scm: |
| 709 env['GCLIENT_SCM'] = scm | 710 env['GCLIENT_SCM'] = str(scm) |
| 710 if parsed_url: | 711 if parsed_url: |
| 711 env['GCLIENT_URL'] = parsed_url | 712 env['GCLIENT_URL'] = str(parsed_url) |
| 712 env['GCLIENT_DEP_PATH'] = self.name | 713 env['GCLIENT_DEP_PATH'] = str(self.name) |
| 713 if options.prepend_dir and scm == 'git': | 714 if options.prepend_dir and scm == 'git': |
| 714 print_stdout = False | 715 print_stdout = False |
| 715 def filter_fn(line): | 716 def filter_fn(line): |
| 716 """Git-specific path marshaling. It is optimized for git-grep.""" | 717 """Git-specific path marshaling. It is optimized for git-grep.""" |
| 717 | 718 |
| 718 def mod_path(git_pathspec): | 719 def mod_path(git_pathspec): |
| 719 match = re.match('^(\\S+?:)?([^\0]+)$', git_pathspec) | 720 match = re.match('^(\\S+?:)?([^\0]+)$', git_pathspec) |
| 720 modified_path = os.path.join(self.name, match.group(2)) | 721 modified_path = os.path.join(self.name, match.group(2)) |
| 721 branch = match.group(1) or '' | 722 branch = match.group(1) or '' |
| 722 return '%s%s' % (branch, modified_path) | 723 return '%s%s' % (branch, modified_path) |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 raise | 1920 raise |
| 1920 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1921 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1921 print >> sys.stderr, 'Error: %s' % str(e) | 1922 print >> sys.stderr, 'Error: %s' % str(e) |
| 1922 return 1 | 1923 return 1 |
| 1923 | 1924 |
| 1924 | 1925 |
| 1925 if '__main__' == __name__: | 1926 if '__main__' == __name__: |
| 1926 sys.exit(Main(sys.argv[1:])) | 1927 sys.exit(Main(sys.argv[1:])) |
| 1927 | 1928 |
| 1928 # vim: ts=2:sw=2:tw=80:et: | 1929 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |