changeset 50027 | 0b4a6912292e |
parent 49961 | 7a8bfc05b691 |
child 50029 | 28dfb2df4ab9 |
50026:3550e4a88ccd | 50027:0b4a6912292e |
---|---|
6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
9 '''Overridden Mercurial commands and functions for the largefiles extension''' |
9 '''Overridden Mercurial commands and functions for the largefiles extension''' |
10 |
10 |
11 import contextlib |
|
11 import copy |
12 import copy |
12 import os |
13 import os |
13 |
14 |
14 from mercurial.i18n import _ |
15 from mercurial.i18n import _ |
15 |
16 |
19 |
20 |
20 from mercurial import ( |
21 from mercurial import ( |
21 archival, |
22 archival, |
22 cmdutil, |
23 cmdutil, |
23 copies as copiesmod, |
24 copies as copiesmod, |
25 dirstate, |
|
24 error, |
26 error, |
25 exchange, |
27 exchange, |
26 extensions, |
28 extensions, |
27 exthelper, |
29 exthelper, |
28 filemerge, |
30 filemerge, |
307 removelargefiles( |
309 removelargefiles( |
308 ui, repo, False, matcher, uipathfn, dryrun, after=after, force=force |
310 ui, repo, False, matcher, uipathfn, dryrun, after=after, force=force |
309 ) |
311 ) |
310 or result |
312 or result |
311 ) |
313 ) |
314 |
|
315 |
|
316 @eh.wrapfunction(dirstate.dirstate, b'_changing') |
|
317 @contextlib.contextmanager |
|
318 def _changing(orig, self, repo, change_type): |
|
319 pre = sub_dirstate = getattr(self, '_sub_dirstate', None) |
|
320 try: |
|
321 lfd = getattr(self, '_large_file_dirstate', False) |
|
322 if sub_dirstate is None and not lfd: |
|
323 sub_dirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
324 self._sub_dirstate = sub_dirstate |
|
325 if not lfd: |
|
326 assert self._sub_dirstate is not None |
|
327 with orig(self, repo, change_type): |
|
328 if sub_dirstate is None: |
|
329 yield |
|
330 else: |
|
331 with sub_dirstate._changing(repo, change_type): |
|
332 yield |
|
333 finally: |
|
334 self._sub_dirstate = pre |
|
312 |
335 |
313 |
336 |
314 @eh.wrapfunction(subrepo.hgsubrepo, b'status') |
337 @eh.wrapfunction(subrepo.hgsubrepo, b'status') |
315 def overridestatusfn(orig, repo, rev2, **opts): |
338 def overridestatusfn(orig, repo, rev2, **opts): |
316 with lfstatus(repo._repo): |
339 with lfstatus(repo._repo): |