Show More
@@ -881,7 +881,7 b' class fixupstate:' | |||
|
881 | 881 | |
|
882 | 882 | dirstate._fsmonitorstate.invalidate = noop |
|
883 | 883 | try: |
|
884 |
with dirstate. |
|
|
884 | with dirstate.changing_parents(self.repo): | |
|
885 | 885 | dirstate.rebuild(ctx.node(), ctx.manifest(), self.paths) |
|
886 | 886 | finally: |
|
887 | 887 | restore() |
@@ -776,7 +776,7 b' def writeworkingdir(repo, ctx, filedata,' | |||
|
776 | 776 | newp1 = replacements.get(oldp1, oldp1) |
|
777 | 777 | if newp1 != oldp1: |
|
778 | 778 | assert repo.dirstate.p2() == nullid |
|
779 |
with repo.dirstate. |
|
|
779 | with repo.dirstate.changing_parents(repo): | |
|
780 | 780 | scmutil.movedirstate(repo, repo[newp1]) |
|
781 | 781 | |
|
782 | 782 |
@@ -384,7 +384,7 b' class gitdirstate:' | |||
|
384 | 384 | pass |
|
385 | 385 | |
|
386 | 386 | @contextlib.contextmanager |
|
387 |
def |
|
|
387 | def changing_parents(self, repo): | |
|
388 | 388 | # TODO: track this maybe? |
|
389 | 389 | yield |
|
390 | 390 |
@@ -696,7 +696,7 b' def kw_amend(orig, ui, repo, old, extra,' | |||
|
696 | 696 | kwt = getattr(repo, '_keywordkwt', None) |
|
697 | 697 | if kwt is None: |
|
698 | 698 | return orig(ui, repo, old, extra, pats, opts) |
|
699 |
with repo.wlock(), repo.dirstate. |
|
|
699 | with repo.wlock(), repo.dirstate.changing_parents(repo): | |
|
700 | 700 | kwt.postcommit = True |
|
701 | 701 | newid = orig(ui, repo, old, extra, pats, opts) |
|
702 | 702 | if newid != old.node(): |
@@ -762,7 +762,7 b' def kw_dorecord(orig, ui, repo, commitfu' | |||
|
762 | 762 | if ctx != recctx: |
|
763 | 763 | modified, added = _preselect(wstatus, recctx.files()) |
|
764 | 764 | kwt.restrict = False |
|
765 |
with repo.dirstate. |
|
|
765 | with repo.dirstate.changing_parents(repo): | |
|
766 | 766 | kwt.overwrite(recctx, modified, False, True) |
|
767 | 767 | kwt.overwrite(recctx, added, False, True, True) |
|
768 | 768 | kwt.restrict = True |
@@ -517,7 +517,7 b' def updatelfiles(' | |||
|
517 | 517 | filelist = set(filelist) |
|
518 | 518 | lfiles = [f for f in lfiles if f in filelist] |
|
519 | 519 | |
|
520 |
with lfdirstate. |
|
|
520 | with lfdirstate.changing_parents(repo): | |
|
521 | 521 | update = {} |
|
522 | 522 | dropped = set() |
|
523 | 523 | updated, removed = 0, 0 |
@@ -580,7 +580,7 b' def updatelfiles(' | |||
|
580 | 580 | statuswriter(_(b'getting changed largefiles\n')) |
|
581 | 581 | cachelfiles(ui, repo, None, lfiles) |
|
582 | 582 | |
|
583 |
with lfdirstate. |
|
|
583 | with lfdirstate.changing_parents(repo): | |
|
584 | 584 | for lfile in lfiles: |
|
585 | 585 | update1 = 0 |
|
586 | 586 |
@@ -231,7 +231,7 b' def openlfdirstate(ui, repo, create=True' | |||
|
231 | 231 | if len(standins) > 0: |
|
232 | 232 | vfs.makedirs(lfstoredir) |
|
233 | 233 | |
|
234 |
with lfdirstate. |
|
|
234 | with lfdirstate.changing_parents(repo): | |
|
235 | 235 | for standin in standins: |
|
236 | 236 | lfile = splitstandin(standin) |
|
237 | 237 | lfdirstate.update_file( |
@@ -581,7 +581,7 b' def markcommitted(orig, ctx, node):' | |||
|
581 | 581 | repo = ctx.repo() |
|
582 | 582 | |
|
583 | 583 | lfdirstate = openlfdirstate(repo.ui, repo) |
|
584 |
with lfdirstate. |
|
|
584 | with lfdirstate.changing_parents(repo): | |
|
585 | 585 | orig(node) |
|
586 | 586 | |
|
587 | 587 | # ATTENTION: "ctx.files()" may differ from "repo[node].files()" |
@@ -660,7 +660,7 b' def overridecalculateupdates(' | |||
|
660 | 660 | def mergerecordupdates(orig, repo, actions, branchmerge, getfiledata): |
|
661 | 661 | if MERGE_ACTION_LARGEFILE_MARK_REMOVED in actions: |
|
662 | 662 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
663 |
with lfdirstate. |
|
|
663 | with lfdirstate.changing_parents(repo): | |
|
664 | 664 | for lfile, args, msg in actions[ |
|
665 | 665 | MERGE_ACTION_LARGEFILE_MARK_REMOVED |
|
666 | 666 | ]: |
@@ -1800,7 +1800,7 b' def mergeupdate(orig, repo, node, branch' | |||
|
1800 | 1800 | raise error.ProgrammingError( |
|
1801 | 1801 | b'largefiles is not compatible with in-memory merge' |
|
1802 | 1802 | ) |
|
1803 |
with lfdirstate. |
|
|
1803 | with lfdirstate.changing_parents(repo): | |
|
1804 | 1804 | result = orig(repo, node, branchmerge, force, *args, **kwargs) |
|
1805 | 1805 | |
|
1806 | 1806 | newstandins = lfutil.getstandinsstate(repo) |
@@ -1082,7 +1082,7 b' class queue:' | |||
|
1082 | 1082 | |
|
1083 | 1083 | if merge and files: |
|
1084 | 1084 | # Mark as removed/merged and update dirstate parent info |
|
1085 |
with repo.dirstate. |
|
|
1085 | with repo.dirstate.changing_parents(repo): | |
|
1086 | 1086 | for f in files: |
|
1087 | 1087 | repo.dirstate.update_file_p1(f, p1_tracked=True) |
|
1088 | 1088 | p1 = repo.dirstate.p1() |
@@ -1830,7 +1830,7 b' class queue:' | |||
|
1830 | 1830 | if keepchanges and tobackup: |
|
1831 | 1831 | raise error.Abort(_(b"local changes found, qrefresh first")) |
|
1832 | 1832 | self.backup(repo, tobackup) |
|
1833 |
with repo.dirstate. |
|
|
1833 | with repo.dirstate.changing_parents(repo): | |
|
1834 | 1834 | for f in a: |
|
1835 | 1835 | repo.wvfs.unlinkpath(f, ignoremissing=True) |
|
1836 | 1836 | repo.dirstate.update_file( |
@@ -1988,7 +1988,7 b' class queue:' | |||
|
1988 | 1988 | |
|
1989 | 1989 | bmlist = repo[top].bookmarks() |
|
1990 | 1990 | |
|
1991 |
with repo.dirstate. |
|
|
1991 | with repo.dirstate.changing_parents(repo): | |
|
1992 | 1992 | # XXX do we actually need the dirstateguard |
|
1993 | 1993 | dsguard = None |
|
1994 | 1994 | try: |
@@ -320,7 +320,7 b' def _narrow(' | |||
|
320 | 320 | repo.store.markremoved(f) |
|
321 | 321 | |
|
322 | 322 | ui.status(_(b'deleting unwanted files from working copy\n')) |
|
323 |
with repo.dirstate. |
|
|
323 | with repo.dirstate.changing_parents(repo): | |
|
324 | 324 | narrowspec.updateworkingcopy(repo, assumeclean=True) |
|
325 | 325 | narrowspec.copytoworkingcopy(repo) |
|
326 | 326 | |
@@ -380,7 +380,7 b' def _widen(' | |||
|
380 | 380 | if ellipsesremote: |
|
381 | 381 | ds = repo.dirstate |
|
382 | 382 | p1, p2 = ds.p1(), ds.p2() |
|
383 |
with ds. |
|
|
383 | with ds.changing_parents(repo): | |
|
384 | 384 | ds.setparents(repo.nullid, repo.nullid) |
|
385 | 385 | if isoldellipses: |
|
386 | 386 | with wrappedextraprepare: |
@@ -419,10 +419,12 b' def _widen(' | |||
|
419 | 419 | bundle2.processbundle(repo, bundle, op=op, remote=remote) |
|
420 | 420 | |
|
421 | 421 | if ellipsesremote: |
|
422 |
with ds. |
|
|
422 | with ds.changing_parents(repo): | |
|
423 | 423 | ds.setparents(p1, p2) |
|
424 | 424 | |
|
425 |
with repo.transaction(b'widening'), repo.dirstate. |
|
|
425 | with repo.transaction(b'widening'), repo.dirstate.changing_parents( | |
|
426 | repo | |
|
427 | ): | |
|
426 | 428 | repo.setnewnarrowpats() |
|
427 | 429 | narrowspec.updateworkingcopy(repo) |
|
428 | 430 | narrowspec.copytoworkingcopy(repo) |
@@ -591,7 +593,7 b' def trackedcmd(ui, repo, remotepath=None' | |||
|
591 | 593 | if update_working_copy: |
|
592 | 594 | with repo.wlock(), repo.lock(), repo.transaction( |
|
593 | 595 | b'narrow-wc' |
|
594 |
), repo.dirstate. |
|
|
596 | ), repo.dirstate.changing_parents(repo): | |
|
595 | 597 | narrowspec.updateworkingcopy(repo) |
|
596 | 598 | narrowspec.copytoworkingcopy(repo) |
|
597 | 599 | return 0 |
@@ -134,7 +134,7 b' def dosplit(ui, repo, tr, ctx, opts):' | |||
|
134 | 134 | # Set working parent to ctx.p1(), and keep working copy as ctx's content |
|
135 | 135 | if ctx.node() != repo.dirstate.p1(): |
|
136 | 136 | hg.clean(repo, ctx.node(), show_stats=False) |
|
137 |
with repo.dirstate. |
|
|
137 | with repo.dirstate.changing_parents(repo): | |
|
138 | 138 | scmutil.movedirstate(repo, ctx.p1()) |
|
139 | 139 | |
|
140 | 140 | # Any modified, added, removed, deleted result means split is incomplete |
@@ -236,7 +236,7 b' def uncommit(ui, repo, *pats, **opts):' | |||
|
236 | 236 | # Fully removed the old commit |
|
237 | 237 | mapping[old.node()] = () |
|
238 | 238 | |
|
239 |
with repo.dirstate. |
|
|
239 | with repo.dirstate.changing_parents(repo): | |
|
240 | 240 | scmutil.movedirstate(repo, repo[newid], match) |
|
241 | 241 | |
|
242 | 242 | scmutil.cleanupnodes(repo, mapping, b'uncommit', fixphase=True) |
@@ -317,7 +317,7 b' def unamend(ui, repo, **opts):' | |||
|
317 | 317 | newpredctx = repo[newprednode] |
|
318 | 318 | dirstate = repo.dirstate |
|
319 | 319 | |
|
320 |
with dirstate. |
|
|
320 | with dirstate.changing_parents(repo): | |
|
321 | 321 | scmutil.movedirstate(repo, newpredctx) |
|
322 | 322 | |
|
323 | 323 | mapping = {curctx.node(): (newprednode,)} |
@@ -216,7 +216,7 b' def reposetup(ui, repo):' | |||
|
216 | 216 | def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs): |
|
217 | 217 | # reset dirstate cache for file we touch |
|
218 | 218 | ds = repo.dirstate |
|
219 |
with ds. |
|
|
219 | with ds.changing_parents(repo): | |
|
220 | 220 | for filename in actions[b'revert'][0]: |
|
221 | 221 | entry = ds.get_entry(filename) |
|
222 | 222 | if entry is not None: |
@@ -638,7 +638,7 b' def dorecord(' | |||
|
638 | 638 | # already called within a `pendingchange`, However we |
|
639 | 639 | # are taking a shortcut here in order to be able to |
|
640 | 640 | # quickly deprecated the older API. |
|
641 |
with dirstate. |
|
|
641 | with dirstate.changing_parents(repo): | |
|
642 | 642 | dirstate.update_file( |
|
643 | 643 | realname, |
|
644 | 644 | p1_tracked=True, |
@@ -1532,7 +1532,7 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
1532 | 1532 | new_node = mem_ctx.commit() |
|
1533 | 1533 | |
|
1534 | 1534 | if repo.dirstate.p1() == ctx.node(): |
|
1535 |
with repo.dirstate. |
|
|
1535 | with repo.dirstate.changing_parents(repo): | |
|
1536 | 1536 | scmutil.movedirstate(repo, repo[new_node]) |
|
1537 | 1537 | replacements = {ctx.node(): [new_node]} |
|
1538 | 1538 | scmutil.cleanupnodes( |
@@ -1625,7 +1625,7 b' def copy(ui, repo, pats, opts, rename=Fa' | |||
|
1625 | 1625 | new_node = mem_ctx.commit() |
|
1626 | 1626 | |
|
1627 | 1627 | if repo.dirstate.p1() == ctx.node(): |
|
1628 |
with repo.dirstate. |
|
|
1628 | with repo.dirstate.changing_parents(repo): | |
|
1629 | 1629 | scmutil.movedirstate(repo, repo[new_node]) |
|
1630 | 1630 | replacements = {ctx.node(): [new_node]} |
|
1631 | 1631 | scmutil.cleanupnodes(repo, replacements, b'copy', fixphase=True) |
@@ -3024,7 +3024,7 b' def amend(ui, repo, old, extra, pats, op' | |||
|
3024 | 3024 | newid = repo.commitctx(new) |
|
3025 | 3025 | ms.reset() |
|
3026 | 3026 | |
|
3027 |
with repo.dirstate. |
|
|
3027 | with repo.dirstate.changing_parents(repo): | |
|
3028 | 3028 | # Reroute the working copy parent to the new changeset |
|
3029 | 3029 | repo.setparents(newid, repo.nullid) |
|
3030 | 3030 |
@@ -6264,7 +6264,7 b' def resolve(ui, repo, *pats, **opts):' | |||
|
6264 | 6264 | # |
|
6265 | 6265 | # All this should eventually happens, but in the mean time, we use this |
|
6266 | 6266 | # context manager slightly out of the context it should be. |
|
6267 |
with repo.dirstate. |
|
|
6267 | with repo.dirstate.changing_parents(repo): | |
|
6268 | 6268 | mergestatemod.recordupdates(repo, ms.actions(), branchmerge, None) |
|
6269 | 6269 | |
|
6270 | 6270 | if not didwork and pats: |
@@ -1595,7 +1595,7 b' class workingctx(committablectx):' | |||
|
1595 | 1595 | if p2node is None: |
|
1596 | 1596 | p2node = self._repo.nodeconstants.nullid |
|
1597 | 1597 | dirstate = self._repo.dirstate |
|
1598 |
with dirstate. |
|
|
1598 | with dirstate.changing_parents(self._repo): | |
|
1599 | 1599 | copies = dirstate.setparents(p1node, p2node) |
|
1600 | 1600 | pctx = self._repo[p1node] |
|
1601 | 1601 | if copies: |
@@ -2050,7 +2050,7 b' class workingctx(committablectx):' | |||
|
2050 | 2050 | return sorted(f for f in ds.matches(match) if ds.get_entry(f).tracked) |
|
2051 | 2051 | |
|
2052 | 2052 | def markcommitted(self, node): |
|
2053 |
with self._repo.dirstate. |
|
|
2053 | with self._repo.dirstate.changing_parents(self._repo): | |
|
2054 | 2054 | for f in self.modified() + self.added(): |
|
2055 | 2055 | self._repo.dirstate.update_file( |
|
2056 | 2056 | f, p1_tracked=True, wc_tracked=True |
@@ -69,7 +69,7 b' class rootcache(filecache):' | |||
|
69 | 69 | def requires_parents_change(func): |
|
70 | 70 | def wrap(self, *args, **kwargs): |
|
71 | 71 | if not self.pendingparentchange(): |
|
72 |
msg = 'calling `%s` outside of a |
|
|
72 | msg = 'calling `%s` outside of a changing_parents context' | |
|
73 | 73 | msg %= func.__name__ |
|
74 | 74 | raise error.ProgrammingError(msg) |
|
75 | 75 | if self._invalidated_context: |
@@ -83,7 +83,7 b' def requires_parents_change(func):' | |||
|
83 | 83 | def requires_no_parents_change(func): |
|
84 | 84 | def wrap(self, *args, **kwargs): |
|
85 | 85 | if self.pendingparentchange(): |
|
86 |
msg = 'calling `%s` inside of a |
|
|
86 | msg = 'calling `%s` inside of a changing_parents context' | |
|
87 | 87 | msg %= func.__name__ |
|
88 | 88 | raise error.ProgrammingError(msg) |
|
89 | 89 | return func(self, *args, **kwargs) |
@@ -127,7 +127,7 b' class dirstate:' | |||
|
127 | 127 | self._dirty_tracked_set = False |
|
128 | 128 | self._ui = ui |
|
129 | 129 | self._filecache = {} |
|
130 |
# nesting level of ` |
|
|
130 | # nesting level of `changing_parents` context | |
|
131 | 131 | self._parentwriters = 0 |
|
132 | 132 | # True if the current dirstate changing operations have been |
|
133 | 133 | # invalidated (used to make sure all nested contexts have been exited) |
@@ -151,7 +151,7 b' class dirstate:' | |||
|
151 | 151 | self._pl |
|
152 | 152 | |
|
153 | 153 | @contextlib.contextmanager |
|
154 |
def |
|
|
154 | def changing_parents(self, repo): | |
|
155 | 155 | """Context manager for handling dirstate parents. |
|
156 | 156 | |
|
157 | 157 | If an exception occurs in the scope of the context manager, |
@@ -180,6 +180,14 b' class dirstate:' | |||
|
180 | 180 | assert self._parentwriters == 0 |
|
181 | 181 | self._invalidated_context = False |
|
182 | 182 | |
|
183 | # here to help migration to the new code | |
|
184 | def parentchange(self): | |
|
185 | msg = ( | |
|
186 | "Mercurial 6.4 and later requires call to " | |
|
187 | "`dirstate.changing_parents(repo)`" | |
|
188 | ) | |
|
189 | raise error.ProgrammingError(msg) | |
|
190 | ||
|
183 | 191 | def pendingparentchange(self): |
|
184 | 192 | """Returns true if the dirstate is in the middle of a set of changes |
|
185 | 193 | that modify the dirstate parent. |
@@ -399,7 +407,7 b' class dirstate:' | |||
|
399 | 407 | if self._parentwriters == 0: |
|
400 | 408 | raise ValueError( |
|
401 | 409 | b"cannot set dirstate parent outside of " |
|
402 |
b"dirstate. |
|
|
410 | b"dirstate.changing_parents context manager" | |
|
403 | 411 | ) |
|
404 | 412 | |
|
405 | 413 | self._dirty = True |
@@ -523,7 +531,7 b' class dirstate:' | |||
|
523 | 531 | rewriting operation. |
|
524 | 532 | |
|
525 | 533 | It should not be called during a merge (p2 != nullid) and only within |
|
526 |
a `with dirstate. |
|
|
534 | a `with dirstate.changing_parents(repo):` context. | |
|
527 | 535 | """ |
|
528 | 536 | if self.in_merge: |
|
529 | 537 | msg = b'update_file_reference should not be called when merging' |
@@ -566,7 +574,7 b' class dirstate:' | |||
|
566 | 574 | This is to be called when the direstates parent changes to keep track |
|
567 | 575 | of what is the file situation in regards to the working copy and its parent. |
|
568 | 576 | |
|
569 |
This function must be called within a `dirstate. |
|
|
577 | This function must be called within a `dirstate.changing_parents` context. | |
|
570 | 578 | |
|
571 | 579 | note: the API is at an early stage and we might need to adjust it |
|
572 | 580 | depending of what information ends up being relevant and useful to |
@@ -35,7 +35,7 b' class idirstate(interfaceutil.Interface)' | |||
|
35 | 35 | _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""") |
|
36 | 36 | |
|
37 | 37 | @contextlib.contextmanager |
|
38 |
def |
|
|
38 | def changing_parents(repo): | |
|
39 | 39 | """Context manager for handling dirstate parents. |
|
40 | 40 | |
|
41 | 41 | If an exception occurs in the scope of the context manager, |
@@ -2155,7 +2155,7 b' def _update(' | |||
|
2155 | 2155 | assert len(getfiledata) == ( |
|
2156 | 2156 | mresult.len((mergestatemod.ACTION_GET,)) if wantfiledata else 0 |
|
2157 | 2157 | ) |
|
2158 |
with repo.dirstate. |
|
|
2158 | with repo.dirstate.changing_parents(repo): | |
|
2159 | 2159 | ### Filter Filedata |
|
2160 | 2160 | # |
|
2161 | 2161 | # We gathered "cache" information for the clean file while |
@@ -2377,7 +2377,7 b' def graft(' | |||
|
2377 | 2377 | # fix up dirstate for copies and renames |
|
2378 | 2378 | copies.graftcopies(wctx, ctx, base) |
|
2379 | 2379 | else: |
|
2380 |
with repo.dirstate. |
|
|
2380 | with repo.dirstate.changing_parents(repo): | |
|
2381 | 2381 | repo.setparents(pctx.node(), pother) |
|
2382 | 2382 | repo.dirstate.write(repo.currenttransaction()) |
|
2383 | 2383 | # fix up dirstate for copies and renames |
@@ -637,7 +637,7 b' def _docreatecmd(ui, repo, pats, opts):' | |||
|
637 | 637 | |
|
638 | 638 | ui.status(_(b'shelved as %s\n') % name) |
|
639 | 639 | if opts[b'keep']: |
|
640 |
with repo.dirstate. |
|
|
640 | with repo.dirstate.changing_parents(repo): | |
|
641 | 641 | scmutil.movedirstate(repo, parent, match) |
|
642 | 642 | else: |
|
643 | 643 | hg.update(repo, parent.node()) |
@@ -862,14 +862,14 b' def unshelvecontinue(ui, repo, state, op' | |||
|
862 | 862 | shelvectx = repo[state.parents[1]] |
|
863 | 863 | pendingctx = state.pendingctx |
|
864 | 864 | |
|
865 |
with repo.dirstate. |
|
|
865 | with repo.dirstate.changing_parents(repo): | |
|
866 | 866 | repo.setparents(state.pendingctx.node(), repo.nullid) |
|
867 | 867 | repo.dirstate.write(repo.currenttransaction()) |
|
868 | 868 | |
|
869 | 869 | targetphase = _target_phase(repo) |
|
870 | 870 | overrides = {(b'phases', b'new-commit'): targetphase} |
|
871 | 871 | with repo.ui.configoverride(overrides, b'unshelve'): |
|
872 |
with repo.dirstate. |
|
|
872 | with repo.dirstate.changing_parents(repo): | |
|
873 | 873 | repo.setparents(state.parents[0], repo.nullid) |
|
874 | 874 | newnode, ispartialunshelve = _createunshelvectx( |
|
875 | 875 | ui, repo, shelvectx, basename, interactive, opts |
@@ -1068,7 +1068,7 b' def _rebaserestoredcommit(' | |||
|
1068 | 1068 | ) |
|
1069 | 1069 | raise error.ConflictResolutionRequired(b'unshelve') |
|
1070 | 1070 | |
|
1071 |
with repo.dirstate. |
|
|
1071 | with repo.dirstate.changing_parents(repo): | |
|
1072 | 1072 | repo.setparents(tmpwctx.node(), repo.nullid) |
|
1073 | 1073 | newnode, ispartialunshelve = _createunshelvectx( |
|
1074 | 1074 | ui, repo, shelvectx, basename, interactive, opts |
@@ -451,7 +451,7 b' def filterupdatesactions(repo, wctx, mct' | |||
|
451 | 451 | message, |
|
452 | 452 | ) |
|
453 | 453 | |
|
454 |
with repo.dirstate. |
|
|
454 | with repo.dirstate.changing_parents(repo): | |
|
455 | 455 | mergemod.applyupdates( |
|
456 | 456 | repo, |
|
457 | 457 | tmresult, |
@@ -655,7 +655,7 b' def clearrules(repo, force=False):' | |||
|
655 | 655 | The remaining sparse config only has profiles, if defined. The working |
|
656 | 656 | directory is refreshed, as needed. |
|
657 | 657 | """ |
|
658 |
with repo.wlock(), repo.dirstate. |
|
|
658 | with repo.wlock(), repo.dirstate.changing_parents(repo): | |
|
659 | 659 | raw = repo.vfs.tryread(b'sparse') |
|
660 | 660 | includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') |
|
661 | 661 | |
@@ -671,7 +671,7 b' def importfromfiles(repo, opts, paths, f' | |||
|
671 | 671 | The updated sparse config is written out and the working directory |
|
672 | 672 | is refreshed, as needed. |
|
673 | 673 | """ |
|
674 |
with repo.wlock(), repo.dirstate. |
|
|
674 | with repo.wlock(), repo.dirstate.changing_parents(repo): | |
|
675 | 675 | # read current configuration |
|
676 | 676 | raw = repo.vfs.tryread(b'sparse') |
|
677 | 677 | includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') |
@@ -730,7 +730,7 b' def updateconfig(' | |||
|
730 | 730 | |
|
731 | 731 | The new config is written out and a working directory refresh is performed. |
|
732 | 732 | """ |
|
733 |
with repo.wlock(), repo.lock(), repo.dirstate. |
|
|
733 | with repo.wlock(), repo.lock(), repo.dirstate.changing_parents(repo): | |
|
734 | 734 | raw = repo.vfs.tryread(b'sparse') |
|
735 | 735 | oldinclude, oldexclude, oldprofiles = parseconfig( |
|
736 | 736 | repo.ui, raw, b'sparse' |
@@ -74,7 +74,7 b' have this method available in narrowhg p' | |||
|
74 | 74 | > narrowspec.copytoworkingcopy(repo) |
|
75 | 75 | > newmatcher = narrowspec.match(repo.root, includes, excludes) |
|
76 | 76 | > added = matchmod.differencematcher(newmatcher, currentmatcher) |
|
77 |
> with repo.dirstate. |
|
|
77 | > with repo.dirstate.changing_parents(repo): | |
|
78 | 78 | > for f in repo[b'.'].manifest().walk(added): |
|
79 | 79 | > repo.dirstate.update_file( |
|
80 | 80 | > f, |
General Comments 0
You need to be logged in to leave comments.
Login now