| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 from webkitpy.common.system.filesystem import FileSystem | 32 from webkitpy.common.system.filesystem import FileSystem |
| 33 from webkitpy.common.system.executive import Executive | 33 from webkitpy.common.system.executive import Executive |
| 34 | 34 |
| 35 from .git import Git | 35 from .git import Git |
| 36 | 36 |
| 37 _log = logging.getLogger(__name__) | 37 _log = logging.getLogger(__name__) |
| 38 | 38 |
| 39 | 39 |
| 40 class SCMDetector(object): | 40 class SCMDetector(object): |
| 41 |
| 41 def __init__(self, filesystem, executive): | 42 def __init__(self, filesystem, executive): |
| 42 self._filesystem = filesystem | 43 self._filesystem = filesystem |
| 43 self._executive = executive | 44 self._executive = executive |
| 44 | 45 |
| 45 def default_scm(self, patch_directories=None): | 46 def default_scm(self, patch_directories=None): |
| 46 """Return the default SCM object as determined by the CWD and running co
de. | 47 """Return the default SCM object as determined by the CWD and running co
de. |
| 47 | 48 |
| 48 Returns the default SCM object for the current working directory; if the | 49 Returns the default SCM object for the current working directory; if the |
| 49 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 |
| 50 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 if Git.in_working_directory(absolute_path, executive=self._executive): | 71 if Git.in_working_directory(absolute_path, executive=self._executive): |
| 71 return Git(cwd=absolute_path, filesystem=self._filesystem, executive
=self._executive) | 72 return Git(cwd=absolute_path, filesystem=self._filesystem, executive
=self._executive) |
| 72 | 73 |
| 73 return None | 74 return None |
| 74 | 75 |
| 75 | 76 |
| 76 # FIXME: These free functions are all deprecated: | 77 # FIXME: These free functions are all deprecated: |
| 77 | 78 |
| 78 def detect_scm_system(path, patch_directories=None): | 79 def detect_scm_system(path, patch_directories=None): |
| 79 return SCMDetector(FileSystem(), Executive()).detect_scm_system(path, patch_
directories) | 80 return SCMDetector(FileSystem(), Executive()).detect_scm_system(path, patch_
directories) |
| OLD | NEW |