# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1503933376 -7200 # Node ID b629874ccaac7278314d3457df39a0b3634b34da # Parent e46b68547017cc30545ab8ce5cdb9c4302b77f60 topics: allow use a --current when setting a topic This patch allow to use the current flag which can be used by user set existing revs to the current topic. diff -r e46b68547017 -r b629874ccaac hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Mon Aug 28 17:35:44 2017 +0200 +++ b/hgext3rd/topic/__init__.py Mon Aug 28 17:16:16 2017 +0200 @@ -338,6 +338,11 @@ The active topic (if any) will be prepended with a "*". + The `--current` flag helps to take active topic into account. For + example, if you want to set the topic on all the draft changesets to the + active topic, you can do: + `hg topic -r "draft()" --current` + The --verbose version of this command display various information on the state of each topic.""" current = opts.get('current') @@ -362,6 +367,8 @@ raise error.Abort(_('must have obsolete enabled to change topics')) if clear: topic = None + elif opts.get('current'): + topic = repo.currenttopic elif not topic: raise error.Abort('changing topic requires a topic name or --clear') if any(not c.mutable() for c in repo.set('%r and public()', rev)): diff -r e46b68547017 -r b629874ccaac tests/test-topic.t --- a/tests/test-topic.t Mon Aug 28 17:35:44 2017 +0200 +++ b/tests/test-topic.t Mon Aug 28 17:16:16 2017 +0200 @@ -38,6 +38,10 @@ The active topic (if any) will be prepended with a "*". + The '--current' flag helps to take active topic into account. For example, + if you want to set the topic on all the draft changesets to the active + topic, you can do: 'hg topic -r "draft()" --current' + The --verbose version of this command display various information on the state of each topic. @@ -744,8 +748,10 @@ | summary: start on fran | - $ hg topics --rev '13::19' changewat - switching to topic changewat +Using the current flag + + $ hg topic changewat + $ hg topics --rev '13::19' --current changed topic on 2 changes $ hg log -Gr 'draft()'