Diff the working version of path with its committed version.
(self, path)
| 931 | yield tree_entry_path |
| 932 | |
| 933 | def diff_file(self, path): |
| 934 | """Diff the working version of path with its committed version.""" |
| 935 | _check_path_is_repo_relative(path) |
| 936 | |
| 937 | git_repo = self.gl_repo.git_repo |
| 938 | git_path = _get_git_path(path) |
| 939 | try: |
| 940 | blob_at_head = git_repo[git_repo.head.peel().tree[git_path].id] |
| 941 | except KeyError: # no blob at head |
| 942 | wt_blob = git_repo[git_repo.create_blob_fromworkdir(git_path)] |
| 943 | nil_blob = git_repo[git_repo.create_blob('')] |
| 944 | return nil_blob.diff(wt_blob, 0, git_path, git_path) |
| 945 | |
| 946 | try: |
| 947 | wt_blob = git_repo[git_repo.create_blob_fromworkdir(git_path)] |
| 948 | except KeyError: # no blob at wd (the file was deleted) |
| 949 | nil_blob = git_repo[git_repo.create_blob('')] |
| 950 | return blob_at_head.diff(nil_blob, 0, git_path, git_path) |
| 951 | |
| 952 | return blob_at_head.diff(wt_blob, 0, git_path, git_path) |
| 953 | |
| 954 | |
| 955 | # Merge-related methods |