Parses a single diff tree entry into its component elements. See git-diff-tree(1) manpage for details about the format of the diff output. This method returns a dictionary with the following elements: src_mode - The mode of the source file dst_mode - The mode of the des
(entry)
| 736 | |
| 737 | |
| 738 | def parseDiffTreeEntry(entry): |
| 739 | """Parses a single diff tree entry into its component elements. |
| 740 | |
| 741 | See git-diff-tree(1) manpage for details about the format of the diff |
| 742 | output. This method returns a dictionary with the following elements: |
| 743 | |
| 744 | src_mode - The mode of the source file |
| 745 | dst_mode - The mode of the destination file |
| 746 | src_sha1 - The sha1 for the source file |
| 747 | dst_sha1 - The sha1 fr the destination file |
| 748 | status - The one letter status of the diff (i.e. 'A', 'M', 'D', etc) |
| 749 | status_score - The score for the status (applicable for 'C' and 'R' |
| 750 | statuses). This is None if there is no score. |
| 751 | src - The path for the source file. |
| 752 | dst - The path for the destination file. This is only present for |
| 753 | copy or renames. If it is not present, this is None. |
| 754 | |
| 755 | If the pattern is not matched, None is returned. |
| 756 | """ |
| 757 | |
| 758 | global _diff_tree_pattern |
| 759 | if not _diff_tree_pattern: |
| 760 | _diff_tree_pattern = re.compile(r':(\d+) (\d+) (\w+) (\w+) ([A-Z])(\d+)?\t(.*?)((\t(.*))|$)') |
| 761 | |
| 762 | match = _diff_tree_pattern.match(entry) |
| 763 | if match: |
| 764 | return { |
| 765 | 'src_mode': match.group(1), |
| 766 | 'dst_mode': match.group(2), |
| 767 | 'src_sha1': match.group(3), |
| 768 | 'dst_sha1': match.group(4), |
| 769 | 'status': match.group(5), |
| 770 | 'status_score': match.group(6), |
| 771 | 'src': match.group(7), |
| 772 | 'dst': match.group(10) |
| 773 | } |
| 774 | return None |
| 775 | |
| 776 | |
| 777 | def isModeExec(mode): |