# HG changeset patch # User Matt Harbison # Date 1599017743 14400 # Node ID 95478db35f8821162726cc41c6f4e8ac6f940720 # Parent 77c0ddd6f172e2936792b5ecc6e60cfea0cf8a66 topic: fix the `topic(...)` revset to not select commits without a topic The problem seems to be that the now removed __contains__ check would select any revision indicated by a non-string argument. This led to `topic(head())` returning a bunch of non-topic heads, though not as many as simply `head()`. I'm likely misunderstanding something, because there appears to be a similar __contains__ check for `branch()` in core. But maybe that's just harder to see the issue, because branch names doesn't disappear like topics. diff -r 77c0ddd6f172 -r 95478db35f88 CHANGELOG --- a/CHANGELOG Sat Aug 22 07:24:46 2020 +0800 +++ b/CHANGELOG Tue Sep 01 23:35:43 2020 -0400 @@ -10,6 +10,8 @@ * split: correctly handle discard action after previously splitting changes into more than one commit + * revset: no longer changeset without topic when running `topic(REVSET)` + 10.0.1 -- 2020-07-31 -------------------- diff -r 77c0ddd6f172 -r 95478db35f88 hgext3rd/topic/revset.py --- a/hgext3rd/topic/revset.py Sat Aug 22 07:24:46 2020 +0800 +++ b/hgext3rd/topic/revset.py Tue Sep 01 23:35:43 2020 -0400 @@ -67,8 +67,6 @@ topics.discard(b'') def matches(r): - if r in s: - return True topic = repo[r].topic() if not topic: return False diff -r 77c0ddd6f172 -r 95478db35f88 tests/test-topic.t --- a/tests/test-topic.t Sat Aug 22 07:24:46 2020 +0800 +++ b/tests/test-topic.t Tue Sep 01 23:35:43 2020 -0400 @@ -750,12 +750,18 @@ fran (1 changesets) $ hg log -r 'topic(.)' (no output is expected) + + $ hg up 8 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo test > gamma + $ hg ci -m non-topic + $ hg log -r 'topic(.)' + $ hg co fran switching to topic fran - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg log -r 'topic(.)' changeset: 9:0469d521db49 - tag: tip topic: fran parent: 3:a53952faf762 user: test @@ -801,19 +807,26 @@ created new head (consider using topic for lightweight branches. See 'hg help topic') $ hg log -Gr 'draft()' - @ changeset: 10:4073470c35e1 + @ changeset: 11:4073470c35e1 | tag: tip + | parent: 9:0469d521db49 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 | summary: fran? | - o changeset: 9:0469d521db49 - | topic: fran - | parent: 3:a53952faf762 - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: start on fran - | + | o changeset: 10:de75ec1bdbe8 + | | parent: 8:ae074045b7a7 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: non-topic + | | + o | changeset: 9:0469d521db49 + | | topic: fran + | | parent: 3:a53952faf762 + | | user: test + | | date: Thu Jan 01 00:00:00 1970 +0000 + | | summary: start on fran + | | $ hg topics fran (1 changesets)