# HG changeset patch # User Anton Shestakov # Date 1705599161 10800 # Node ID d3668c704d407bfb0ea16fd116a68e694d3f0cf5 # Parent 81fe0a498447dd1e676090bd21f45d3a51ccc15a topic: use the appropriate functions to change topic and tns on wdir update This way we don't write the default topic/tns values into the files. It's safer this way if any of the default values change at some point (as it did for topic namespaces). diff -r 81fe0a498447 -r d3668c704d40 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Jan 27 17:36:39 2024 -0300 +++ b/hgext3rd/topic/__init__.py Thu Jan 18 14:32:41 2024 -0300 @@ -1704,10 +1704,10 @@ if pctx.phase() > phases.public: tns = pctx.topic_namespace() t = pctx.topic() - repo.vfs.write(b'topic-namespace', tns) + _changecurrenttns(repo, tns) if tns != b'none' and tns != otns: repo.ui.status(_(b"switching to topic-namespace %s\n") % tns) - repo.vfs.write(b'topic', t) + _changecurrenttopic(repo, t) if t and t != ot: repo.ui.status(_(b"switching to topic %s\n") % t) if ot and not t: diff -r 81fe0a498447 -r d3668c704d40 tests/test-namespaces.t --- a/tests/test-namespaces.t Sat Jan 27 17:36:39 2024 -0300 +++ b/tests/test-namespaces.t Thu Jan 18 14:32:41 2024 -0300 @@ -94,8 +94,12 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ hg debug-topic-namespace none + $ test -f .hg/topic-namespace + [1] $ hg topics feature (1 changesets) + $ test -f .hg/topic + [1] $ hg up 0 switching to topic-namespace alice switching to topic feature @@ -104,6 +108,8 @@ alice $ hg topics * feature (1 changesets) + $ cat .hg/topic + feature (no-eol) Updating to a topic namespace is not supported