| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 input=stdin, | 96 input=stdin, |
| 97 return_exit_code=return_exit_code, | 97 return_exit_code=return_exit_code, |
| 98 decode_output=decode_output) | 98 decode_output=decode_output) |
| 99 | 99 |
| 100 def absolute_path(self, repository_relative_path): | 100 def absolute_path(self, repository_relative_path): |
| 101 """Converts repository-relative paths to absolute paths.""" | 101 """Converts repository-relative paths to absolute paths.""" |
| 102 return self._filesystem.join(self.checkout_root, repository_relative_pat
h) | 102 return self._filesystem.join(self.checkout_root, repository_relative_pat
h) |
| 103 | 103 |
| 104 def in_working_directory(self, path): | 104 def in_working_directory(self, path): |
| 105 try: | 105 try: |
| 106 self._executive.run_command( | 106 return self._executive.run_command( |
| 107 [self._executable_name, 'rev-parse', '--is-inside-work-tree'], | 107 [self._executable_name, 'rev-parse', '--is-inside-work-tree'], |
| 108 cwd=path, error_handler=Executive.ignore_error).rstrip() == 'tru
e' | 108 cwd=path, error_handler=Executive.ignore_error).rstrip() == 'tru
e' |
| 109 except OSError: | 109 except OSError: |
| 110 # The Windows bots seem to throw a WindowsError when git isn't insta
lled. | 110 # The Windows bots seem to throw a WindowsError when git isn't insta
lled. |
| 111 # TODO(qyearsley): Check if this is still necessary and remove if po
ssible. | 111 # TODO(qyearsley): Check if this is still necessary and remove if po
ssible. |
| 112 _log.warn('Got OSError when running Git.in_working_directory.') | 112 _log.warn('Got OSError when running Git.in_working_directory.') |
| 113 return False | 113 return False |
| 114 | 114 |
| 115 def find_checkout_root(self, path): | 115 def find_checkout_root(self, path): |
| 116 # "git rev-parse --show-cdup" would be another way to get to the root | 116 # "git rev-parse --show-cdup" would be another way to get to the root |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 match = re.search(r"^\s*(?P<branch_name>\S+)\s+merges with remote master
$", origin_info, re.MULTILINE) | 390 match = re.search(r"^\s*(?P<branch_name>\S+)\s+merges with remote master
$", origin_info, re.MULTILINE) |
| 391 if not match: | 391 if not match: |
| 392 raise ScriptError(message='Unable to find local branch tracking orig
in/master.') | 392 raise ScriptError(message='Unable to find local branch tracking orig
in/master.') |
| 393 branch = str(match.group('branch_name')) | 393 branch = str(match.group('branch_name')) |
| 394 return self._branch_from_ref(self.run(['rev-parse', '--symbolic-full-nam
e', branch]).strip()) | 394 return self._branch_from_ref(self.run(['rev-parse', '--symbolic-full-nam
e', branch]).strip()) |
| 395 | 395 |
| 396 def ensure_cleanly_tracking_remote_master(self): | 396 def ensure_cleanly_tracking_remote_master(self): |
| 397 self._discard_working_directory_changes() | 397 self._discard_working_directory_changes() |
| 398 self.run(['checkout', '-q', self._branch_tracking_remote_master()]) | 398 self.run(['checkout', '-q', self._branch_tracking_remote_master()]) |
| 399 self._discard_local_commits() | 399 self._discard_local_commits() |
| OLD | NEW |