| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 if '..' not in git_commit: | 228 if '..' not in git_commit: |
| 229 git_commit = git_commit + '^..' + git_commit | 229 git_commit = git_commit + '^..' + git_commit |
| 230 return git_commit | 230 return git_commit |
| 231 | 231 |
| 232 return self._remote_merge_base() | 232 return self._remote_merge_base() |
| 233 | 233 |
| 234 def changed_files(self, git_commit=None, diff_filter='ADM'): | 234 def changed_files(self, git_commit=None, diff_filter='ADM'): |
| 235 # FIXME: --diff-filter could be used to avoid the "extract_filenames" st
ep. | 235 # FIXME: --diff-filter could be used to avoid the "extract_filenames" st
ep. |
| 236 status_command = ['diff', '-r', '--name-status', | 236 status_command = ['diff', '-r', '--name-status', |
| 237 '--no-renames', '--no-ext-diff', '--full-index', self.
_merge_base(git_commit)] | 237 '--no-renames', '--no-ext-diff', '--full-index', self.
_merge_base(git_commit)] |
| 238 # FIXME: I'm not sure we're returning the same set of files that SVN.cha
nged_files is. | |
| 239 # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) | 238 # Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) |
| 240 return self._run_status_and_extract_filenames(status_command, self._stat
us_regexp(diff_filter)) | 239 return self._run_status_and_extract_filenames(status_command, self._stat
us_regexp(diff_filter)) |
| 241 | 240 |
| 242 def added_files(self): | 241 def added_files(self): |
| 243 return self._run_status_and_extract_filenames(self.status_command(), sel
f._status_regexp('A')) | 242 return self._run_status_and_extract_filenames(self.status_command(), sel
f._status_regexp('A')) |
| 244 | 243 |
| 245 def _run_status_and_extract_filenames(self, status_command, status_regexp): | 244 def _run_status_and_extract_filenames(self, status_command, status_regexp): |
| 246 filenames = [] | 245 filenames = [] |
| 247 # We run with cwd=self.checkout_root so that returned-paths are root-rel
ative. | 246 # We run with cwd=self.checkout_root so that returned-paths are root-rel
ative. |
| 248 for line in self._run_git(status_command, cwd=self.checkout_root).splitl
ines(): | 247 for line in self._run_git(status_command, cwd=self.checkout_root).splitl
ines(): |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 if self.current_branch() != self._branch_tracking_remote_master(): | 405 if self.current_branch() != self._branch_tracking_remote_master(): |
| 407 return False | 406 return False |
| 408 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: | 407 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: |
| 409 return False | 408 return False |
| 410 return True | 409 return True |
| 411 | 410 |
| 412 def ensure_cleanly_tracking_remote_master(self): | 411 def ensure_cleanly_tracking_remote_master(self): |
| 413 self._discard_working_directory_changes() | 412 self._discard_working_directory_changes() |
| 414 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) | 413 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) |
| 415 self._discard_local_commits() | 414 self._discard_local_commits() |
| OLD | NEW |