# HG changeset patch # User Anton Shestakov # Date 1689619959 10800 # Node ID 90b631fde2d76559f77c92be52aa889603a1cb50 # Parent ce67a138c5d6daf3b0a8477164586f80a7c661d4 topic: only set topic on workingcommitctx if it doesn't already have one This fix is so obvious, that I wonder, if this is the correct thing to do, why wasn't it done like this from the beginning. Despite my doubts, all the tests pass. diff -r ce67a138c5d6 -r 90b631fde2d7 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Jul 05 15:51:56 2023 -0300 +++ b/hgext3rd/topic/__init__.py Mon Jul 17 15:52:39 2023 -0300 @@ -556,7 +556,7 @@ def commitctx(self, ctx, *args, **kwargs): if isinstance(ctx, context.workingcommitctx): current = self.currenttopic - if current: + if current and constants.extrakey not in ctx.extra(): ctx.extra()[constants.extrakey] = current return super(topicrepo, self).commitctx(ctx, *args, **kwargs) diff -r ce67a138c5d6 -r 90b631fde2d7 tests/test-namespaces.t --- a/tests/test-namespaces.t Wed Jul 05 15:51:56 2023 -0300 +++ b/tests/test-namespaces.t Mon Jul 17 15:52:39 2023 -0300 @@ -71,6 +71,51 @@ abort: unknown revision 'alice' [10] +Export/import of topic namespaces + + $ hg export + # HG changeset patch + # User test + # Date 0 0 + # Thu Jan 01 00:00:00 1970 +0000 + # Branch stable + # Node ID 69c7dbf6acd180eeec055dd67933badd3601d45f + # Parent 0000000000000000000000000000000000000000 + # EXP-Topic feature + a + + diff -r 000000000000 -r 69c7dbf6acd1 a + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +a + + $ hg import - << EOF + > # HG changeset patch + > # User test + > # Date 0 0 + > # Thu Jan 01 00:00:00 1970 +0000 + > # Branch another-branch + > # Node ID 94981e5d988ea23cf2b17f6c07c39edc0f174b01 + > # Parent d6d47657e765570283ec03fc68836d9eb297c4b3 + > # EXP-Topic mytopic + > added z + > + > diff --git a/z b/z + > new file mode 100644 + > --- /dev/null + > +++ b/z + > @@ -0,0 +1,1 @@ + > +z + > EOF + applying patch from stdin + + $ hg log -r tip -T '{rev}: {branch} {topic_namespace} {topic}\n' + 1: stable alice mytopic + + $ hg log -r tip -T '{rev}: {fqbn}\n' + 1: stable//alice/mytopic + Revsets $ nslog() { @@ -79,14 +124,19 @@ $ nslog 'topicnamespace(:)' 0: alice + 1: alice $ nslog 'topicnamespace(all())' 0: alice + 1: alice $ nslog 'topicnamespace(topicnamespace("alice"))' 0: alice + 1: alice $ nslog 'topicnamespace(wdir())' 0: alice + 1: alice $ nslog 'topicnamespace("re:ice$")' 0: alice + 1: alice $ nslog 'topicnamespace(nonsense)' abort: unknown revision 'nonsense' [10]