Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 6487:963471ebe26a
topic: make topic namespace use string "none" as the default/empty value
The rationale is to not let topic namespaces be confused with neither default
branch nor the actual default namespace value (which is planned to be
configurable, but probably will be local user name by default).
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 19 May 2023 10:08:19 -0300 |
parents | 94d459a37494 |
children | 71a8d4db4f55 |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Mon May 22 20:33:39 2023 -0300 +++ b/hgext3rd/topic/__init__.py Fri May 19 10:08:19 2023 -0300 @@ -298,17 +298,17 @@ def _contexttns(self, force=False): if not force and not self.mutable(): - return b'default' + return b'none' cache = getattr(self._repo, '_tnscache', None) # topic loaded, but not enabled (eg: multiple repo in the same process) if cache is None: - return b'default' + return b'none' if self.rev() is None: # don't cache volatile ctx instances that aren't stored on-disk yet - return self.extra().get(b'topic-namespace', b'default') + return self.extra().get(b'topic-namespace', b'none') tns = cache.get(self.rev()) if tns is None: - tns = self.extra().get(b'topic-namespace', b'default') + tns = self.extra().get(b'topic-namespace', b'none') self._repo._tnscache[self.rev()] = tns return tns @@ -576,7 +576,7 @@ @property def currenttns(self): - return self.vfs.tryread(b'topic-namespace') or b'default' + return self.vfs.tryread(b'topic-namespace') or b'none' @util.propertycache def _topiccache(self): @@ -817,7 +817,7 @@ self._extra[b'topic-namespace'] = repo.currenttns else: # Default value will be dropped from extra by another hack at the changegroup level - self._extra[b'topic-namespace'] = b'default' + self._extra[b'topic-namespace'] = b'none' if constants.extrakey not in self._extra: if getattr(repo, 'currenttopic', b''): self._extra[constants.extrakey] = repo.currenttopic @@ -828,7 +828,7 @@ def wrapadd(orig, cl, manifest, files, desc, transaction, p1, p2, user, date=None, extra=None, p1copies=None, p2copies=None, filesadded=None, filesremoved=None): - if b'topic-namespace' in extra and extra[b'topic-namespace'] == b'default': + if b'topic-namespace' in extra and extra[b'topic-namespace'] == b'none': extra = extra.copy() del extra[b'topic-namespace'] if constants.extrakey in extra and not extra[constants.extrakey]: @@ -1518,14 +1518,14 @@ if repo.ui.configbool(b'_internal', b'keep-topic'): ist0 = True if ((not partial and not branchmerge) or isrebase) and not ist0: - tns = b'default' + tns = b'none' t = b'' pctx = repo[node] if pctx.phase() > phases.public: tns = pctx.topic_namespace() t = pctx.topic() repo.vfs.write(b'topic-namespace', tns) - if tns != b'default' and tns != otns: + if tns != b'none' and tns != otns: repo.ui.status(_(b"switching to topic-namespace %s\n") % tns) repo.vfs.write(b'topic', t) if t and t != ot: @@ -1651,7 +1651,7 @@ scmutil.checknewlabel(repo, tns, b'topic namespace') ctns = repo.currenttns _changecurrenttns(repo, tns) - if ctns == b'default' and tns: + if ctns == b'none' and tns: repo.ui.status(_(b'marked working directory as topic namespace: %s\n') % tns)