|
Lines 144-150
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec1
|
| 144 |
return self._filesystem.exists(self.absolute_path(self._filesystem.join('.git', 'rebase-apply'))) |
144 |
return self._filesystem.exists(self.absolute_path(self._filesystem.join('.git', 'rebase-apply'))) |
| 145 |
|
145 |
|
| 146 |
def working_directory_is_clean(self): |
146 |
def working_directory_is_clean(self): |
| 147 |
return self.run(['git', 'diff', 'HEAD', '--name-only'], cwd=self.checkout_root) == "" |
147 |
return self.run(['git', 'diff', 'HEAD', '--no-renames', '--name-only'], cwd=self.checkout_root) == "" |
| 148 |
|
148 |
|
| 149 |
def clean_working_directory(self): |
149 |
def clean_working_directory(self): |
| 150 |
# FIXME: These should probably use cwd=self.checkout_root. |
150 |
# FIXME: These should probably use cwd=self.checkout_root. |
|
Lines 157-163
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec2
|
| 157 |
def status_command(self): |
157 |
def status_command(self): |
| 158 |
# git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead. |
158 |
# git status returns non-zero when there are changes, so we use git diff name --name-status HEAD instead. |
| 159 |
# No file contents printed, thus utf-8 autodecoding in self.run is fine. |
159 |
# No file contents printed, thus utf-8 autodecoding in self.run is fine. |
| 160 |
return ["git", "diff", "--name-status", "HEAD"] |
160 |
return ["git", "diff", "--name-status", "--no-renames", "HEAD"] |
| 161 |
|
161 |
|
| 162 |
def _status_regexp(self, expected_types): |
162 |
def _status_regexp(self, expected_types): |
| 163 |
return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types |
163 |
return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types |
|
Lines 186-192
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec3
|
| 186 |
|
186 |
|
| 187 |
def changed_files(self, git_commit=None): |
187 |
def changed_files(self, git_commit=None): |
| 188 |
# FIXME: --diff-filter could be used to avoid the "extract_filenames" step. |
188 |
# FIXME: --diff-filter could be used to avoid the "extract_filenames" step. |
| 189 |
status_command = ['git', 'diff', '-r', '--name-status', '-C', '-M', "--no-ext-diff", "--full-index", self.merge_base(git_commit)] |
189 |
status_command = ['git', 'diff', '-r', '--name-status', "--no-renames", "--no-ext-diff", "--full-index", self.merge_base(git_commit)] |
| 190 |
# FIXME: I'm not sure we're returning the same set of files that SVN.changed_files is. |
190 |
# FIXME: I'm not sure we're returning the same set of files that SVN.changed_files is. |
| 191 |
# Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) |
191 |
# Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R) |
| 192 |
return self.run_status_and_extract_filenames(status_command, self._status_regexp("ADM")) |
192 |
return self.run_status_and_extract_filenames(status_command, self._status_regexp("ADM")) |
|
Lines 209-215
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec4
|
| 209 |
def conflicted_files(self): |
209 |
def conflicted_files(self): |
| 210 |
# We do not need to pass decode_output for this diff command |
210 |
# We do not need to pass decode_output for this diff command |
| 211 |
# as we're passing --name-status which does not output any data. |
211 |
# as we're passing --name-status which does not output any data. |
| 212 |
status_command = ['git', 'diff', '--name-status', '-C', '-M', '--diff-filter=U'] |
212 |
status_command = ['git', 'diff', '--name-status', '--no-renames', '--diff-filter=U'] |
| 213 |
return self.run_status_and_extract_filenames(status_command, self._status_regexp("U")) |
213 |
return self.run_status_and_extract_filenames(status_command, self._status_regexp("U")) |
| 214 |
|
214 |
|
| 215 |
def added_files(self): |
215 |
def added_files(self): |
|
Lines 244-250
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec5
|
| 244 |
"""Returns a byte array (str()) representing the patch file. |
244 |
"""Returns a byte array (str()) representing the patch file. |
| 245 |
Patch files are effectively binary since they may contain |
245 |
Patch files are effectively binary since they may contain |
| 246 |
files of multiple different encodings.""" |
246 |
files of multiple different encodings.""" |
| 247 |
command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"] |
247 |
command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "--no-renames", self.merge_base(git_commit), "--"] |
| 248 |
if changed_files: |
248 |
if changed_files: |
| 249 |
command += changed_files |
249 |
command += changed_files |
| 250 |
return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root)) |
250 |
return self.prepend_svn_revision(self.run(command, decode_output=False, cwd=self.checkout_root)) |
|
Lines 282-288
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec6
|
| 282 |
return self.create_patch(git_commit) |
282 |
return self.create_patch(git_commit) |
| 283 |
|
283 |
|
| 284 |
def diff_for_file(self, path, log=None): |
284 |
def diff_for_file(self, path, log=None): |
| 285 |
return self.run(['git', 'diff', 'HEAD', '--', path], cwd=self.checkout_root) |
285 |
return self.run(['git', 'diff', 'HEAD', '--no-renames', '--', path], cwd=self.checkout_root) |
| 286 |
|
286 |
|
| 287 |
def show_head(self, path): |
287 |
def show_head(self, path): |
| 288 |
return self.run(['git', 'show', 'HEAD:' + self.to_object_name(path)], decode_output=False) |
288 |
return self.run(['git', 'show', 'HEAD:' + self.to_object_name(path)], decode_output=False) |
|
Lines 462-465
class Git(SCM, SVNRepository):
a/Tools/Scripts/webkitpy/common/checkout/scm/git.py_sec7
|
| 462 |
return CommitMessage(commit_lines[first_line_after_headers:]) |
462 |
return CommitMessage(commit_lines[first_line_after_headers:]) |
| 463 |
|
463 |
|
| 464 |
def files_changed_summary_for_commit(self, commit_id): |
464 |
def files_changed_summary_for_commit(self, commit_id): |
| 465 |
return self.run(['git', 'diff-tree', '--shortstat', '--no-commit-id', commit_id]) |
465 |
return self.run(['git', 'diff-tree', '--shortstat', '--no-renames', '--no-commit-id', commit_id]) |