Convenience wrapper of Git's index.
(self)
| 694 | |
| 695 | @property |
| 696 | def _index(self): |
| 697 | """Convenience wrapper of Git's index.""" |
| 698 | class Index(object): |
| 699 | |
| 700 | def __init__(self, git_index): |
| 701 | self._git_index = git_index |
| 702 | self._git_index.read() |
| 703 | |
| 704 | def __enter__(self): |
| 705 | return self |
| 706 | |
| 707 | def __exit__(self, type, value, traceback): |
| 708 | if not value: # no exception |
| 709 | self._git_index.write() |
| 710 | return True |
| 711 | |
| 712 | def __getattr__(self, name): |
| 713 | return getattr(self._git_index, name) |
| 714 | |
| 715 | return Index(self.gl_repo.git_repo.index) |
| 716 | |
| 717 | _st_map = { |
| 718 | # git status: gl status, exists_at_head, exists_in_wd, modified, conflict |