# HG changeset patch # User Augie Fackler # Date 1443650802 14400 # Node ID 70d1191fceedc28483cdcabf8f6b8729133a4368 # Parent 29fc43f249489bdb8187b6eddad40befb977d2e8 topic: allow use of topic(.) to match the p1 topic As far as I can tell this matches the behavior of branch(.) in core hg in tht it matches p1's value rather than the wdir value. diff --git a/src/topic/revset.py b/src/topic/revset.py --- a/src/topic/revset.py +++ b/src/topic/revset.py @@ -15,6 +15,8 @@ if args: # match a specific topic topic = revset.getstring(args[0], 'topic() argument must be a string') + if topic == '.': + topic = repo['.'].extra().get('topic', '') _kind, _pattern, matcher = revset._stringmatcher(topic) else: matcher = lambda t: bool(t) diff --git a/tests/test-topic.t b/tests/test-topic.t --- a/tests/test-topic.t +++ b/tests/test-topic.t @@ -450,11 +450,25 @@ | summary: start on fran | -Move to fran, note that the topic activates, then deactivate the topic. - +Match current topic: + $ hg topic + fran + $ hg log -r 'topic(.)' +(no output is expected) $ hg co fran switching to topic fran 2 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 + date: Thu Jan 01 00:00:00 1970 +0000 + summary: start on fran + + +Deactivate the topic. $ hg topics * fran $ hg topics --clear