OLD | NEW |
1 # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2009, 2010, 2011 Google Inc. All rights reserved. |
2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 CWD is not in a checkout, then we attempt to figure out if the SCM modul
e | 50 CWD is not in a checkout, then we attempt to figure out if the SCM modul
e |
51 itself is part of a checkout, and return that one. If neither is part of | 51 itself is part of a checkout, and return that one. If neither is part of |
52 a checkout, None is returned. | 52 a checkout, None is returned. |
53 """ | 53 """ |
54 cwd = self._filesystem.getcwd() | 54 cwd = self._filesystem.getcwd() |
55 scm_system = self.detect_scm_system(cwd, patch_directories) | 55 scm_system = self.detect_scm_system(cwd, patch_directories) |
56 if not scm_system: | 56 if not scm_system: |
57 script_directory = self._filesystem.dirname(self._filesystem.path_to
_module(self.__module__)) | 57 script_directory = self._filesystem.dirname(self._filesystem.path_to
_module(self.__module__)) |
58 scm_system = self.detect_scm_system(script_directory, patch_director
ies) | 58 scm_system = self.detect_scm_system(script_directory, patch_director
ies) |
59 if scm_system: | 59 if scm_system: |
60 _log.info("The current directory (%s) is not a WebKit checkout,
using %s" % (cwd, scm_system.checkout_root)) | 60 _log.info("The current directory (%s) is not a WebKit checkout,
using %s", cwd, scm_system.checkout_root) |
61 else: | 61 else: |
62 raise Exception("FATAL: Failed to determine the SCM system for e
ither %s or %s" % (cwd, script_directory)) | 62 raise Exception("FATAL: Failed to determine the SCM system for e
ither %s or %s" % (cwd, script_directory)) |
63 return scm_system | 63 return scm_system |
64 | 64 |
65 def detect_scm_system(self, path, patch_directories=None): | 65 def detect_scm_system(self, path, patch_directories=None): |
66 absolute_path = self._filesystem.abspath(path) | 66 absolute_path = self._filesystem.abspath(path) |
67 | 67 |
68 if patch_directories == []: | 68 if patch_directories == []: |
69 patch_directories = None | 69 patch_directories = None |
70 | 70 |
71 if Git.in_working_directory(absolute_path, executive=self._executive): | 71 if Git.in_working_directory(absolute_path, executive=self._executive): |
72 return Git(cwd=absolute_path, filesystem=self._filesystem, executive
=self._executive) | 72 return Git(cwd=absolute_path, filesystem=self._filesystem, executive
=self._executive) |
73 | 73 |
74 return None | 74 return None |
75 | 75 |
76 | 76 |
77 # FIXME: These free functions are all deprecated: | 77 # FIXME: These free functions are all deprecated: |
78 | 78 |
79 def detect_scm_system(path, patch_directories=None): | 79 def detect_scm_system(path, patch_directories=None): |
80 return SCMDetector(FileSystem(), Executive()).detect_scm_system(path, patch_
directories) | 80 return SCMDetector(FileSystem(), Executive()).detect_scm_system(path, patch_
directories) |
OLD | NEW |