Show More
@@ -1469,6 +1469,8 b' class localrepository:' | |||||
1469 | # post-dirstate-status hooks |
|
1469 | # post-dirstate-status hooks | |
1470 | self._postdsstatus = [] |
|
1470 | self._postdsstatus = [] | |
1471 |
|
1471 | |||
|
1472 | self._pending_narrow_pats = None | |||
|
1473 | ||||
1472 | # generic mapping between names and nodes |
|
1474 | # generic mapping between names and nodes | |
1473 | self.names = namespaces.namespaces() |
|
1475 | self.names = namespaces.namespaces() | |
1474 |
|
1476 | |||
@@ -1799,7 +1801,11 b' class localrepository:' | |||||
1799 |
|
1801 | |||
1800 | A tuple of (includes, excludes). |
|
1802 | A tuple of (includes, excludes). | |
1801 | """ |
|
1803 | """ | |
1802 | return narrowspec.load(self) |
|
1804 | # the narrow management should probably move into its own object | |
|
1805 | val = self._pending_narrow_pats | |||
|
1806 | if val is None: | |||
|
1807 | val = narrowspec.load(self) | |||
|
1808 | return val | |||
1803 |
|
1809 | |||
1804 | @storecache(narrowspec.FILENAME) |
|
1810 | @storecache(narrowspec.FILENAME) | |
1805 | def _storenarrowmatch(self): |
|
1811 | def _storenarrowmatch(self): |
@@ -5,6 +5,7 b'' | |||||
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
|
8 | import weakref | |||
8 |
|
9 | |||
9 | from .i18n import _ |
|
10 | from .i18n import _ | |
10 | from .pycompat import getattr |
|
11 | from .pycompat import getattr | |
@@ -174,10 +175,40 b' def load(repo):' | |||||
174 |
|
175 | |||
175 |
|
176 | |||
176 | def save(repo, includepats, excludepats): |
|
177 | def save(repo, includepats, excludepats): | |
|
178 | repo = repo.unfiltered() | |||
|
179 | ||||
177 | validatepatterns(includepats) |
|
180 | validatepatterns(includepats) | |
178 | validatepatterns(excludepats) |
|
181 | validatepatterns(excludepats) | |
179 | spec = format(includepats, excludepats) |
|
182 | spec = format(includepats, excludepats) | |
180 | repo.svfs.write(FILENAME, spec) |
|
183 | ||
|
184 | tr = repo.currenttransaction() | |||
|
185 | if tr is None: | |||
|
186 | repo.svfs.write(FILENAME, spec) | |||
|
187 | else: | |||
|
188 | # the roundtrip is sometime different | |||
|
189 | # not taking any chance for now | |||
|
190 | value = parseconfig(repo.ui, spec) | |||
|
191 | reporef = weakref.ref(repo) | |||
|
192 | ||||
|
193 | def clean_pending(tr): | |||
|
194 | r = reporef() | |||
|
195 | if r is not None: | |||
|
196 | r._pending_narrow_pats = None | |||
|
197 | ||||
|
198 | tr.addpostclose(b'narrow-spec', clean_pending) | |||
|
199 | tr.addabort(b'narrow-spec', clean_pending) | |||
|
200 | repo._pending_narrow_pats = value | |||
|
201 | ||||
|
202 | def write_spec(f): | |||
|
203 | f.write(spec) | |||
|
204 | ||||
|
205 | tr.addfilegenerator( | |||
|
206 | # XXX think about order at some point | |||
|
207 | b"narrow-spec", | |||
|
208 | (FILENAME,), | |||
|
209 | write_spec, | |||
|
210 | location=b'store', | |||
|
211 | ) | |||
181 |
|
212 | |||
182 |
|
213 | |||
183 | def copytoworkingcopy(repo): |
|
214 | def copytoworkingcopy(repo): |
General Comments 0
You need to be logged in to leave comments.
Login now