Mercurial > hg
comparison mercurial/localrepo.py @ 50022:e333cc169c45
dirstate: rename `pendingparentchange` to `is_changing_parents`
This is clearer and more inline witht he other change we did.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 30 Jan 2023 19:21:34 +0100 |
parents | 376395868b7b |
children | e1cff85484e2 |
comparison
equal
deleted
inserted
replaced
50021:4e955a7a6a55 | 50022:e333cc169c45 |
---|---|
610 # repository was shared the old way. We check the share source .hg/requires | 610 # repository was shared the old way. We check the share source .hg/requires |
611 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs | 611 # for SHARESAFE_REQUIREMENT to detect whether the current repository needs |
612 # to be reshared | 612 # to be reshared |
613 hint = _(b"see `hg help config.format.use-share-safe` for more information") | 613 hint = _(b"see `hg help config.format.use-share-safe` for more information") |
614 if requirementsmod.SHARESAFE_REQUIREMENT in requirements: | 614 if requirementsmod.SHARESAFE_REQUIREMENT in requirements: |
615 | |
616 if ( | 615 if ( |
617 shared | 616 shared |
618 and requirementsmod.SHARESAFE_REQUIREMENT | 617 and requirementsmod.SHARESAFE_REQUIREMENT |
619 not in _readrequires(sharedvfs, True) | 618 not in _readrequires(sharedvfs, True) |
620 ): | 619 ): |
2119 # Build the return dicts. Have to re-encode tag names because | 2118 # Build the return dicts. Have to re-encode tag names because |
2120 # the tags module always uses UTF-8 (in order not to lose info | 2119 # the tags module always uses UTF-8 (in order not to lose info |
2121 # writing to the cache), but the rest of Mercurial wants them in | 2120 # writing to the cache), but the rest of Mercurial wants them in |
2122 # local encoding. | 2121 # local encoding. |
2123 tags = {} | 2122 tags = {} |
2124 for (name, (node, hist)) in alltags.items(): | 2123 for name, (node, hist) in alltags.items(): |
2125 if node != self.nullid: | 2124 if node != self.nullid: |
2126 tags[encoding.tolocal(name)] = node | 2125 tags[encoding.tolocal(name)] = node |
2127 tags[b'tip'] = self.changelog.tip() | 2126 tags[b'tip'] = self.changelog.tip() |
2128 tagtypes = { | 2127 tagtypes = { |
2129 encoding.tolocal(name): value for (name, value) in tagtypes.items() | 2128 encoding.tolocal(name): value for (name, value) in tagtypes.items() |
2898 for filt in repoview.filtertable.keys(): | 2897 for filt in repoview.filtertable.keys(): |
2899 filtered = self.filtered(filt) | 2898 filtered = self.filtered(filt) |
2900 filtered.branchmap().write(filtered) | 2899 filtered.branchmap().write(filtered) |
2901 | 2900 |
2902 def invalidatecaches(self): | 2901 def invalidatecaches(self): |
2903 | |
2904 if '_tagscache' in vars(self): | 2902 if '_tagscache' in vars(self): |
2905 # can't use delattr on proxy | 2903 # can't use delattr on proxy |
2906 del self.__dict__['_tagscache'] | 2904 del self.__dict__['_tagscache'] |
2907 | 2905 |
2908 self._branchcaches.clear() | 2906 self._branchcaches.clear() |
3070 ): | 3068 ): |
3071 if self._currentlock(self._lockref) is not None: | 3069 if self._currentlock(self._lockref) is not None: |
3072 self.ui.develwarn(b'"wlock" acquired after "lock"') | 3070 self.ui.develwarn(b'"wlock" acquired after "lock"') |
3073 | 3071 |
3074 def unlock(): | 3072 def unlock(): |
3075 if self.dirstate.pendingparentchange(): | 3073 if self.dirstate.is_changing_parents: |
3076 msg = b"wlock release in the middle of a changing parents" | 3074 msg = b"wlock release in the middle of a changing parents" |
3077 self.ui.develwarn(msg) | 3075 self.ui.develwarn(msg) |
3078 self.dirstate.invalidate() | 3076 self.dirstate.invalidate() |
3079 else: | 3077 else: |
3080 self.dirstate.write(None) | 3078 self.dirstate.write(None) |
3547 assert name.startswith(b'journal') | 3545 assert name.startswith(b'journal') |
3548 return os.path.join(base, name.replace(b'journal', b'undo', 1)) | 3546 return os.path.join(base, name.replace(b'journal', b'undo', 1)) |
3549 | 3547 |
3550 | 3548 |
3551 def instance(ui, path: bytes, create, intents=None, createopts=None): | 3549 def instance(ui, path: bytes, create, intents=None, createopts=None): |
3552 | |
3553 # prevent cyclic import localrepo -> upgrade -> localrepo | 3550 # prevent cyclic import localrepo -> upgrade -> localrepo |
3554 from . import upgrade | 3551 from . import upgrade |
3555 | 3552 |
3556 localpath = urlutil.urllocalpath(path) | 3553 localpath = urlutil.urllocalpath(path) |
3557 if create: | 3554 if create: |