Mercurial > evolve
changeset 6549:e45bfd1e0588
topic: don't write namespace into commit extras if there's no topic
Topic namespace is considered a part of topic, but topic is more important than
just namespace alone, so it doesn't make a lot of sense to have topic namespace
on a commit unless it also has topic.
We could simple ignore topic namespace in such cases, but it makes sense to not
record it at all.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 06 Sep 2023 14:45:42 -0300 |
parents | 445240ccb701 |
children | fa14b9fc953d |
files | hgext3rd/topic/__init__.py tests/test-namespaces-report.t |
diffstat | 2 files changed, 36 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Thu Jul 27 16:39:43 2023 -0300 +++ b/hgext3rd/topic/__init__.py Wed Sep 06 14:45:42 2023 -0300 @@ -954,6 +954,10 @@ if constants.extrakey in extra and not extra[constants.extrakey]: extra = extra.copy() del extra[constants.extrakey] + if constants.extrakey not in extra and b'topic-namespace' in extra: + # if topic is not in extra, drop namespace as well + extra = extra.copy() + del extra[b'topic-namespace'] # hg <= 4.9 (0e41f40b01cc) kwargs = {} if p1copies is not None:
--- a/tests/test-namespaces-report.t Thu Jul 27 16:39:43 2023 -0300 +++ b/tests/test-namespaces-report.t Wed Sep 06 14:45:42 2023 -0300 @@ -40,11 +40,11 @@ $ echo banana > b $ hg debug-topic-namespace bob marked working directory as topic namespace: bob + $ hg topic b + marked working directory as topic: b $ hg ci -qAm 'banana' -XXX: should not require --new-branch - - $ hg push ../case-1 --new-branch + $ hg push ../case-1 pushing to ../case-1 searching for changes adding changesets @@ -67,9 +67,7 @@ $ hg debug-topic-namespace bruce $ hg ci --amend -m 'broccoli' -XXX: should not require --new-branch - - $ hg push ../case-2 --new-branch + $ hg push ../case-2 pushing to ../case-2 searching for changes adding changesets @@ -96,6 +94,7 @@ $ cd orig $ hg debug-topic-namespace charlie + $ hg topic c $ echo coconut > c $ hg ci -qAm 'coconut' @@ -107,14 +106,12 @@ 1 new phase-divergent changesets $ hg evolve --phase-divergent - recreate:[4] cloudberry + recreate:[s1] cloudberry atop:[3] coconut - committed as c398b3caf447 - working directory is now at c398b3caf447 + committed as 9f1abc6f4a6f + working directory is now at 9f1abc6f4a6f -XXX: should not require --new-branch - - $ hg push ../case-3 --new-branch + $ hg push ../case-3 pushing to ../case-3 searching for changes adding changesets @@ -139,6 +136,8 @@ searching for changes no changes found topic namespaces affected: carol + active topic 'c' is now empty + (use 'hg topic --clear' to clear it if needed) [1] $ cd .. @@ -153,12 +152,11 @@ $ cd orig $ hg debug-topic-namespace dana + $ hg topic d $ echo durian > d $ hg ci -qAm 'durian' -XXX: should not require --new-branch - - $ hg push ../case-5 --new-branch + $ hg push ../case-5 pushing to ../case-5 searching for changes adding changesets @@ -171,9 +169,7 @@ $ echo dragonfruit > d $ hg ci --amend -m 'dragonfruit' -XXX: should not require --new-branch - - $ hg push ../case-5 --new-branch + $ hg push ../case-5 pushing to ../case-5 searching for changes adding changesets @@ -185,8 +181,8 @@ obsoleted 1 changesets $ hg bookmark --hidden -r 'desc("durian")' @ - bookmarking hidden changeset ac97707e6b4a - (hidden revision 'ac97707e6b4a' was rewritten as: 822ac0064503) + bookmarking hidden changeset c56d89b2348b + (hidden revision 'c56d89b2348b' was rewritten as: 7fc662c4767d) $ hg push ../case-5 -B @ pushing to ../case-5 @@ -208,17 +204,24 @@ $ hg clone orig case-6 -q $ cd orig +XXX: we see "active topic is now empty" twice because stack doesn't handle topic namespaces yet + $ hg push ../case-6 -r . --publish pushing to ../case-6 searching for changes no changes found topic namespaces affected: dave + active topic 'd' is now empty + active topic 'd' is now empty + (use 'hg topic --clear' to clear it if needed) [1] previous topic namespace is resurrected... $ hg phase --secret --force -r . --config 'devel.tns-report-transactions=phase' topic namespaces affected: dave + active topic 'd' grew its first changeset + (see 'hg help topics' for more information) ...just to disappear again @@ -227,6 +230,8 @@ searching for changes no changes found topic namespaces affected: dave + active topic 'd' is now empty + (use 'hg topic --clear' to clear it if needed) [1] $ cd .. @@ -240,11 +245,13 @@ $ cd orig $ hg phase --draft --force -r tip + active topic 'd' grew its first changeset + (see 'hg help topics' for more information) $ hg phase --secret --force -r tip -R ../case-7 + active topic 'd' grew its first changeset + (see 'hg help topics' for more information) -XXX: should not require --new-branch - - $ hg push ../case-7 -r . --config 'devel.tns-report-transactions=*' --new-branch + $ hg push ../case-7 -r . --config 'devel.tns-report-transactions=*' pushing to ../case-7 searching for changes adding changesets @@ -252,6 +259,8 @@ adding file changes topic namespaces affected: dave added 0 changesets with 0 changes to 1 files + active topic 'd' grew its first changeset + (see 'hg help topics' for more information) $ cd ..