| 538 | # Diff |
| 539 | # |
| 540 | def __whatever_to_tree_or_blob(self, obj): |
| 541 | if obj is None: |
| 542 | return None |
| 543 | |
| 544 | # If it's a string, then it has to be valid revspec |
| 545 | if isinstance(obj, str) or isinstance(obj, bytes): |
| 546 | obj = self.revparse_single(obj) |
| 547 | elif isinstance(obj, Oid): |
| 548 | obj = self[obj] |
| 549 | |
| 550 | # First we try to get to a blob |
| 551 | try: |
| 552 | obj = obj.peel(Blob) |
| 553 | except Exception: |
| 554 | # And if that failed, try to get a tree, raising a type |
| 555 | # error if that still doesn't work |
| 556 | try: |
| 557 | obj = obj.peel(Tree) |
| 558 | except Exception: |
| 559 | raise TypeError(f'unexpected "{type(obj)}"') |
| 560 | |
| 561 | return obj |
| 562 | |
| 563 | @overload |
| 564 | def diff( |