Mercurial > evolve
changeset 2649:cf930521f14d
topics: add some noise to rewrittent changeset to prevent hash cycle
If we have a changeset with topic `x`, we change it's topic to `y`, fine.
When we change it's topic back again to `x`, we get the hash of the the
obsoleted changeset which had the topic `x` initially. The same happens for few
more cases like clearing the topic of a changeset which initially had no topic.
This approach is influenced from cmdutil.amend and other commands (rebase, histedit, etc…)
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 21 Jun 2017 07:32:11 +0530 |
parents | d8b47d961c77 |
children | db788700ed82 |
files | hgext3rd/topic/__init__.py hgext3rd/topic/constants.py tests/test-topic.t |
diffstat | 3 files changed, 26 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Wed Jun 21 13:18:47 2017 +0200 +++ b/hgext3rd/topic/__init__.py Wed Jun 21 07:32:11 2017 +0530 @@ -331,6 +331,7 @@ del fixedextra[constants.extrakey] else: fixedextra[constants.extrakey] = newtopic + fixedextra[constants.changekey] = c.hex() if 'amend_source' in fixedextra: # TODO: right now the commitctx wrapper in # topicrepo overwrites the topic in extra if
--- a/hgext3rd/topic/constants.py Wed Jun 21 13:18:47 2017 +0200 +++ b/hgext3rd/topic/constants.py Wed Jun 21 07:32:11 2017 +0530 @@ -1,1 +1,2 @@ extrakey = 'topic' +changekey = '_rewrite_noise'
--- a/tests/test-topic.t Wed Jun 21 13:18:47 2017 +0200 +++ b/tests/test-topic.t Wed Jun 21 07:32:11 2017 +0530 @@ -556,7 +556,7 @@ changed topic on 1 changes please run hg evolve --rev "not topic()" now $ hg log -Gr 'draft() and not obsolete()' - o changeset: 11:783930e1d79e + o changeset: 11:0beca5ab56c3 | tag: tip | parent: 3:a53952faf762 | user: test @@ -581,7 +581,7 @@ changed topic on 1 changes please run hg evolve --rev "topic(wat)" now $ hg log -Gr 'draft() and not obsolete()' - o changeset: 13:d91cd8fd490e + o changeset: 13:686a642006db | tag: tip | topic: wat | parent: 3:a53952faf762 @@ -589,7 +589,7 @@ | date: Thu Jan 01 00:00:00 1970 +0000 | summary: start on fran | - | @ changeset: 12:d9e32f4c4806 + | @ changeset: 12:18b70b8de1f0 | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 | | trouble: unstable @@ -600,17 +600,17 @@ bonus deps in the testsuite. $ hg rebase -d tip -s . - rebasing 12:d9e32f4c4806 "fran?" + rebasing 12:18b70b8de1f0 "fran?" $ hg log -Gr 'draft()' - @ changeset: 14:cf24ad8bbef5 + @ changeset: 14:503497a14c3e | tag: tip | topic: wat | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 13:d91cd8fd490e + o changeset: 13:686a642006db | topic: wat | parent: 3:a53952faf762 | user: test @@ -623,15 +623,15 @@ $ hg topic watwat $ hg ci --amend $ hg log -Gr 'draft()' - @ changeset: 16:893ffcf66c1f + @ changeset: 16:024d9c69f30f | tag: tip | topic: watwat - | parent: 13:d91cd8fd490e + | parent: 13:686a642006db | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 13:d91cd8fd490e + o changeset: 13:686a642006db | topic: wat | parent: 3:a53952faf762 | user: test @@ -644,9 +644,9 @@ $ hg topic --clear $ hg ci --amend $ hg log -r . - changeset: 18:a13639e22b65 + changeset: 18:573ab57c6de2 tag: tip - parent: 13:d91cd8fd490e + parent: 13:686a642006db user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: fran? @@ -661,15 +661,15 @@ $ hg co 19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -Gr 'draft()' - @ changeset: 19:b72b86a1f96b + @ changeset: 19:2539ecb09b37 | tag: tip | topic: watwat - | parent: 13:d91cd8fd490e + | parent: 13:686a642006db | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 13:d91cd8fd490e + o changeset: 13:686a642006db | topic: wat | parent: 3:a53952faf762 | user: test @@ -683,14 +683,14 @@ changed topic on 2 changes please run hg evolve --rev "topic(changewat)" now $ hg log -Gr 'draft()' - @ changeset: 21:58e15a6365ca + @ changeset: 21:993d145391f5 | tag: tip | topic: changewat | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 20:a96ac830b62e + o changeset: 20:ceba5be9d56f | topic: changewat | parent: 3:a53952faf762 | user: test @@ -707,21 +707,21 @@ $ echo gamma >> gamma $ hg ci -m gamma $ hg log -Gr 'draft()' - @ changeset: 22:373f490f8854 + @ changeset: 22:0d3d805542b4 | tag: tip | topic: changewat - | parent: 20:a96ac830b62e + | parent: 20:ceba5be9d56f | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: gamma | - | o changeset: 21:58e15a6365ca + | o changeset: 21:993d145391f5 |/ topic: changewat | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 20:a96ac830b62e + o changeset: 20:ceba5be9d56f | topic: changewat | parent: 3:a53952faf762 | user: test @@ -734,21 +734,21 @@ changed topic on 3 changes please run hg evolve --rev "topic(changewut)" now $ hg log -Gr 'draft()' - @ changeset: 25:05d1bf93e1d8 + @ changeset: 25:729ed5717393 | tag: tip | topic: changewut - | parent: 23:1f668635e0c2 + | parent: 23:62e49f09f883 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: gamma | - | o changeset: 24:696f1024fbfb + | o changeset: 24:658ae31a0c05 |/ topic: changewut | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 23:1f668635e0c2 + o changeset: 23:62e49f09f883 | topic: changewut | parent: 3:a53952faf762 | user: test