100 self._mapcls = dirstatemap |
100 self._mapcls = dirstatemap |
101 # Access and cache cwd early, so we don't access it for the first time |
101 # Access and cache cwd early, so we don't access it for the first time |
102 # after a working-copy update caused it to not exist (accessing it then |
102 # after a working-copy update caused it to not exist (accessing it then |
103 # raises an exception). |
103 # raises an exception). |
104 self._cwd |
104 self._cwd |
|
105 |
|
106 def prefetch_parents(self): |
|
107 """make sure the parents are loaded |
|
108 |
|
109 Used to avoid a race condition. |
|
110 """ |
|
111 self._pl |
105 |
112 |
106 @contextlib.contextmanager |
113 @contextlib.contextmanager |
107 def parentchange(self): |
114 def parentchange(self): |
108 '''Context manager for handling dirstate parents. |
115 '''Context manager for handling dirstate parents. |
109 |
116 |
1746 def get(self, *args, **kwargs): |
1753 def get(self, *args, **kwargs): |
1747 return self._rustmap.get(*args, **kwargs) |
1754 return self._rustmap.get(*args, **kwargs) |
1748 |
1755 |
1749 @propertycache |
1756 @propertycache |
1750 def _rustmap(self): |
1757 def _rustmap(self): |
1751 self._rustmap = rustmod.DirstateMap(self._root) |
1758 """ |
|
1759 Fills the Dirstatemap when called. |
|
1760 Use `self._inner_rustmap` if reading the dirstate is not necessary. |
|
1761 """ |
|
1762 self._rustmap = self._inner_rustmap |
1752 self.read() |
1763 self.read() |
1753 return self._rustmap |
1764 return self._rustmap |
|
1765 |
|
1766 @propertycache |
|
1767 def _inner_rustmap(self): |
|
1768 """ |
|
1769 Does not fill the Dirstatemap when called. This allows for |
|
1770 optimizations where only setting/getting the parents is needed. |
|
1771 """ |
|
1772 self._inner_rustmap = rustmod.DirstateMap(self._root) |
|
1773 return self._inner_rustmap |
1754 |
1774 |
1755 @property |
1775 @property |
1756 def copymap(self): |
1776 def copymap(self): |
1757 return self._rustmap.copymap() |
1777 return self._rustmap.copymap() |
1758 |
1778 |
1759 def preload(self): |
1779 def preload(self): |
1760 self._rustmap |
1780 self._rustmap |
1761 |
1781 |
1762 def clear(self): |
1782 def clear(self): |
1763 self._rustmap.clear() |
1783 self._rustmap.clear() |
|
1784 self._inner_rustmap.clear() |
1764 self.setparents(nullid, nullid) |
1785 self.setparents(nullid, nullid) |
1765 util.clearcachedproperty(self, b"_dirs") |
1786 util.clearcachedproperty(self, b"_dirs") |
1766 util.clearcachedproperty(self, b"_alldirs") |
1787 util.clearcachedproperty(self, b"_alldirs") |
1767 util.clearcachedproperty(self, b"dirfoldmap") |
1788 util.clearcachedproperty(self, b"dirfoldmap") |
1768 |
1789 |