OLD | NEW |
1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 os.environ['LC_MESSAGES'] = 'en_US.UTF-8' | 78 os.environ['LC_MESSAGES'] = 'en_US.UTF-8' |
79 os.environ['LC_ALL'] = '' | 79 os.environ['LC_ALL'] = '' |
80 | 80 |
81 # FIXME: This is a horrible, horrible hack for WinPort and should be removed
. | 81 # FIXME: This is a horrible, horrible hack for WinPort and should be removed
. |
82 # Maybe this belongs in Git in some more generic "find the git binary" codep
ath? | 82 # Maybe this belongs in Git in some more generic "find the git binary" codep
ath? |
83 # Or possibly Executive should have a way to emulate shell path-lookups? | 83 # Or possibly Executive should have a way to emulate shell path-lookups? |
84 # FIXME: Unclear how to test this, since it currently mutates global state o
n Git. | 84 # FIXME: Unclear how to test this, since it currently mutates global state o
n Git. |
85 def _engage_awesome_windows_hacks(self): | 85 def _engage_awesome_windows_hacks(self): |
86 try: | 86 try: |
87 self.executive.run_command(['git', 'help']) | 87 self.executive.run_command(['git', 'help']) |
88 except OSError as e: | 88 except OSError: |
89 try: | 89 try: |
90 self.executive.run_command(['git.bat', 'help']) | 90 self.executive.run_command(['git.bat', 'help']) |
91 # The Win port uses the depot_tools package, which contains a nu
mber | 91 # The Win port uses the depot_tools package, which contains a nu
mber |
92 # of development tools, including Python and git. Instead of usi
ng a | 92 # of development tools, including Python and git. Instead of usi
ng a |
93 # real git executable, depot_tools indirects via a batch file, c
alled | 93 # real git executable, depot_tools indirects via a batch file, c
alled |
94 # git.bat. This batch file allows depot_tools to auto-update the
real | 94 # git.bat. This batch file allows depot_tools to auto-update the
real |
95 # git executable, which is contained in a subdirectory. | 95 # git executable, which is contained in a subdirectory. |
96 # | 96 # |
97 # That's all fine and good, except that subprocess.popen can det
ect | 97 # That's all fine and good, except that subprocess.popen can det
ect |
98 # the difference between a real git executable and batch file wh
en we | 98 # the difference between a real git executable and batch file wh
en we |
99 # don't provide use shell=True. Rather than use shell=True on Wi
ndows, | 99 # don't provide use shell=True. Rather than use shell=True on Wi
ndows, |
100 # We hack the git.bat name into the SVN class. | 100 # We hack the git.bat name into the SVN class. |
101 _log.debug('Engaging git.bat Windows hack.') | 101 _log.debug('Engaging git.bat Windows hack.') |
102 from webkitpy.common.checkout.scm.git import Git | 102 from webkitpy.common.checkout.scm.git import Git |
103 Git.executable_name = 'git.bat' | 103 Git.executable_name = 'git.bat' |
104 except OSError as e: | 104 except OSError: |
105 _log.debug('Failed to engage git.bat Windows hack.') | 105 _log.debug('Failed to engage git.bat Windows hack.') |
106 | 106 |
107 def initialize_scm(self, patch_directories=None): | 107 def initialize_scm(self, patch_directories=None): |
108 if sys.platform == "win32": | 108 if sys.platform == "win32": |
109 self._engage_awesome_windows_hacks() | 109 self._engage_awesome_windows_hacks() |
110 detector = SCMDetector(self.filesystem, self.executive) | 110 detector = SCMDetector(self.filesystem, self.executive) |
111 self._scm = detector.default_scm(patch_directories) | 111 self._scm = detector.default_scm(patch_directories) |
112 | 112 |
113 def scm(self): | 113 def scm(self): |
114 return self._scm | 114 return self._scm |
115 | 115 |
116 def scm_for_path(self, path): | 116 def scm_for_path(self, path): |
117 # FIXME: make scm() be a wrapper around this, and clean up the way | 117 # FIXME: make scm() be a wrapper around this, and clean up the way |
118 # callers call initialize_scm() (to remove patch_directories) and scm(). | 118 # callers call initialize_scm() (to remove patch_directories) and scm(). |
119 if sys.platform == "win32": | 119 if sys.platform == "win32": |
120 self._engage_awesome_windows_hacks() | 120 self._engage_awesome_windows_hacks() |
121 return SCMDetector(self.filesystem, self.executive).detect_scm_system(pa
th) | 121 return SCMDetector(self.filesystem, self.executive).detect_scm_system(pa
th) |
OLD | NEW |