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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 logging.info('Dependency(%s).run()' % self.name) | 795 logging.info('Dependency(%s).run()' % self.name) |
796 assert self._file_list == [] | 796 assert self._file_list == [] |
797 if not self.should_process: | 797 if not self.should_process: |
798 return | 798 return |
799 # When running runhooks, there's no need to consult the SCM. | 799 # When running runhooks, there's no need to consult the SCM. |
800 # All known hooks are expected to run unconditionally regardless of working | 800 # All known hooks are expected to run unconditionally regardless of working |
801 # copy state, so skip the SCM status check. | 801 # copy state, so skip the SCM status check. |
802 run_scm = command not in ('runhooks', 'recurse', None) | 802 run_scm = command not in ('runhooks', 'recurse', None) |
803 parsed_url = self.LateOverride(self.url) | 803 parsed_url = self.LateOverride(self.url) |
804 file_list = [] if not options.nohooks else None | 804 file_list = [] if not options.nohooks else None |
| 805 revision_override = revision_overrides.pop(self.name, None) |
805 if run_scm and parsed_url: | 806 if run_scm and parsed_url: |
806 if isinstance(parsed_url, self.FileImpl): | 807 if isinstance(parsed_url, self.FileImpl): |
807 # Special support for single-file checkout. | 808 # Special support for single-file checkout. |
808 if not command in (None, 'cleanup', 'diff', 'pack', 'status'): | 809 if not command in (None, 'cleanup', 'diff', 'pack', 'status'): |
809 # Sadly, pylint doesn't realize that parsed_url is of FileImpl. | 810 # Sadly, pylint doesn't realize that parsed_url is of FileImpl. |
810 # pylint: disable=E1103 | 811 # pylint: disable=E1103 |
811 options.revision = parsed_url.GetRevision() | 812 options.revision = parsed_url.GetRevision() |
812 self._used_scm = gclient_scm.SVNWrapper( | 813 self._used_scm = gclient_scm.SVNWrapper( |
813 parsed_url.GetPath(), self.root.root_dir, self.name, | 814 parsed_url.GetPath(), self.root.root_dir, self.name, |
814 out_cb=work_queue.out_cb) | 815 out_cb=work_queue.out_cb) |
815 self._used_scm.RunCommand('updatesingle', | 816 self._used_scm.RunCommand('updatesingle', |
816 options, args + [parsed_url.GetFilename()], file_list) | 817 options, args + [parsed_url.GetFilename()], file_list) |
817 else: | 818 else: |
818 # Create a shallow copy to mutate revision. | 819 # Create a shallow copy to mutate revision. |
819 options = copy.copy(options) | 820 options = copy.copy(options) |
820 options.revision = revision_overrides.pop(self.name, None) | 821 options.revision = revision_override |
821 self.maybeGetParentRevision( | 822 self.maybeGetParentRevision( |
822 command, options, parsed_url, self.parent) | 823 command, options, parsed_url, self.parent) |
823 self._used_revision = options.revision | 824 self._used_revision = options.revision |
824 self._used_scm = gclient_scm.CreateSCM( | 825 self._used_scm = gclient_scm.CreateSCM( |
825 parsed_url, self.root.root_dir, self.name, self.outbuf, | 826 parsed_url, self.root.root_dir, self.name, self.outbuf, |
826 out_cb=work_queue.out_cb) | 827 out_cb=work_queue.out_cb) |
827 self._got_revision = self._used_scm.RunCommand(command, options, args, | 828 self._got_revision = self._used_scm.RunCommand(command, options, args, |
828 file_list) | 829 file_list) |
829 if file_list: | 830 if file_list: |
830 file_list = [os.path.join(self.name, f.strip()) for f in file_list] | 831 file_list = [os.path.join(self.name, f.strip()) for f in file_list] |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 print >> sys.stderr, 'Error: %s' % str(e) | 2254 print >> sys.stderr, 'Error: %s' % str(e) |
2254 return 1 | 2255 return 1 |
2255 finally: | 2256 finally: |
2256 gclient_utils.PrintWarnings() | 2257 gclient_utils.PrintWarnings() |
2257 | 2258 |
2258 | 2259 |
2259 if '__main__' == __name__: | 2260 if '__main__' == __name__: |
2260 sys.exit(Main(sys.argv[1:])) | 2261 sys.exit(Main(sys.argv[1:])) |
2261 | 2262 |
2262 # vim: ts=2:sw=2:tw=80:et: | 2263 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |