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, author=None): | 268 def commit_locally_with_message(self, message, commit_all_working_directory_
changes=True): |
269 command = ['commit', '-F', '-'] | 269 command = ['commit', '-F', '-'] |
270 if commit_all_working_directory_changes: | 270 if commit_all_working_directory_changes: |
271 command.insert(1, '--all') | 271 command.insert(1, '--all') |
272 if author: | |
273 command.insert(1, "--author='%s'" % (author)) | |
274 self._run_git(command, input=message) | 272 self._run_git(command, input=message) |
275 | 273 |
276 # These methods are git specific and are meant to provide support for the Gi
t oriented workflow | 274 # These methods are git specific and are meant to provide support for the Gi
t oriented workflow |
277 # that Blink is moving towards, hence there are no equivalent methods in the
SVN class. | 275 # that Blink is moving towards, hence there are no equivalent methods in the
SVN class. |
278 | 276 |
279 def pull(self): | 277 def pull(self): |
280 self._run_git(['pull']) | 278 self._run_git(['pull']) |
281 | 279 |
282 def latest_git_commit(self): | 280 def latest_git_commit(self): |
283 return self._run_git(['log', '-1', '--format=%H']).strip() | 281 return self._run_git(['log', '-1', '--format=%H']).strip() |
(...skipping 25 matching lines...) Expand all Loading... |
309 if self.current_branch() != self._branch_tracking_remote_master(): | 307 if self.current_branch() != self._branch_tracking_remote_master(): |
310 return False | 308 return False |
311 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: | 309 if len(self._local_commits(self._branch_tracking_remote_master())) > 0: |
312 return False | 310 return False |
313 return True | 311 return True |
314 | 312 |
315 def ensure_cleanly_tracking_remote_master(self): | 313 def ensure_cleanly_tracking_remote_master(self): |
316 self._discard_working_directory_changes() | 314 self._discard_working_directory_changes() |
317 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) | 315 self._run_git(['checkout', '-q', self._branch_tracking_remote_master()]) |
318 self._discard_local_commits() | 316 self._discard_local_commits() |
OLD | NEW |