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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 def _remote_merge_base(self): | 258 def _remote_merge_base(self): |
259 return self._run_git(['merge-base', self._remote_branch_ref(), 'HEAD']).
strip() | 259 return self._run_git(['merge-base', self._remote_branch_ref(), 'HEAD']).
strip() |
260 | 260 |
261 def _remote_branch_ref(self): | 261 def _remote_branch_ref(self): |
262 # Use references so that we can avoid collisions, e.g. we don't want to
operate on refs/heads/trunk if it exists. | 262 # Use references so that we can avoid collisions, e.g. we don't want to
operate on refs/heads/trunk if it exists. |
263 remote_master_ref = 'refs/remotes/origin/master' | 263 remote_master_ref = 'refs/remotes/origin/master' |
264 if not self._branch_ref_exists(remote_master_ref): | 264 if not self._branch_ref_exists(remote_master_ref): |
265 raise ScriptError(message="Can't find a branch to diff against. %s d
oes not exist" % remote_master_ref) | 265 raise ScriptError(message="Can't find a branch to diff against. %s d
oes not exist" % remote_master_ref) |
266 return remote_master_ref | 266 return remote_master_ref |
267 | 267 |
268 def commit_locally_with_message(self, message, commit_all_working_directory_
changes=True): | 268 def commit_locally_with_message(self, message): |
269 command = ['commit', '-F', '-'] | 269 command = ['commit', '--all', '-F', '-'] |
270 if commit_all_working_directory_changes: | |
271 command.insert(1, '--all') | |
272 self._run_git(command, input=message) | 270 self._run_git(command, input=message) |
273 | 271 |
274 # These methods are git specific and are meant to provide support for the Gi
t oriented workflow | 272 # These methods are git specific and are meant to provide support for the Gi
t oriented workflow |
275 # that Blink is moving towards, hence there are no equivalent methods in the
SVN class. | 273 # that Blink is moving towards, hence there are no equivalent methods in the
SVN class. |
276 | 274 |
277 def pull(self): | 275 def pull(self): |
278 self._run_git(['pull']) | 276 self._run_git(['pull']) |
279 | 277 |
280 def latest_git_commit(self): | 278 def latest_git_commit(self): |
281 return self._run_git(['log', '-1', '--format=%H']).strip() | 279 return self._run_git(['log', '-1', '--format=%H']).strip() |
(...skipping 25 matching lines...) Expand all Loading... |
307 if self.current_branch() != self._branch_tracking_remote_master(): | 305 if self.current_branch() != self._branch_tracking_remote_master(): |
308 return False | 306 return False |
309 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: | 307 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: |
310 return False | 308 return False |
311 return True | 309 return True |
312 | 310 |
313 def ensure_cleanly_tracking_remote_master(self): | 311 def ensure_cleanly_tracking_remote_master(self): |
314 self._discard_working_directory_changes() | 312 self._discard_working_directory_changes() |
315 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) | 313 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) |
316 self._discard_local_commits() | 314 self._discard_local_commits() |
OLD | NEW |