Mercurial > evolve
changeset 2643:a9ca94defc29
topics: rename '--change' flag to '--rev' flag
The --change flag was used to read a revset of which topic should be changed. In
mercurial we use --rev for this type of flag.
Now things will work as follows:
`hg topics topicname`: It will set the current topic
`hg topics topicname --rev revset`: Change topic of all the revs in the revset
to topicname
Further patches will try to achieve the following:
`hg topics --clear --rev revset`: clear topic from all the revisions in the
revset
`hg topics --clear`: clear the current topic (Current behavior)
`hg topics --rev revset`: show topics on the revisions in the revset
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 21 Jun 2017 02:00:01 +0530 |
parents | 92e882a82aaf |
children | 78de089a7830 |
files | README hgext3rd/topic/__init__.py tests/test-topic.t |
diffstat | 3 files changed, 21 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/README Wed Jun 21 01:05:46 2017 +0530 +++ b/README Wed Jun 21 02:00:01 2017 +0530 @@ -130,6 +130,7 @@ - stack: also show the unstable status for the current changeset (issue5553) - stack: properly abort when and unknown topic is requested, - topic: fix issue5441 in the linear case, + - topic: topics: rename '--change' flag to '--rev' flag, 6.4.1 - in progress -------------------
--- a/hgext3rd/topic/__init__.py Wed Jun 21 01:05:46 2017 +0530 +++ b/hgext3rd/topic/__init__.py Wed Jun 21 02:00:01 2017 +0530 @@ -255,30 +255,30 @@ @command('topics [TOPIC]', [ ('', 'clear', False, 'clear active topic if any'), - ('', 'change', '', 'revset of existing revisions to change topic'), + ('r', 'rev', '', 'revset of existing revisions', _('REV')), ('l', 'list', False, 'show the stack of changeset in the topic'), ] + commands.formatteropts) -def topics(ui, repo, topic='', clear=False, change=None, list=False, **opts): +def topics(ui, repo, topic='', clear=False, rev=None, list=False, **opts): """View current topic, set current topic, or see all topics. The --verbose version of this command display various information on the state of each topic.""" if list: - if clear or change: - raise error.Abort(_("cannot use --clear or --change with --list")) + if clear or rev: + raise error.Abort(_("cannot use --clear or --rev with --list")) if not topic: topic = repo.currenttopic if not topic: raise error.Abort(_('no active topic to list')) return stack.showstack(ui, repo, topic, opts) - if change: + if rev: if not obsolete.isenabled(repo, obsolete.createmarkersopt): - raise error.Abort(_('must have obsolete enabled to use --change')) + raise error.Abort(_('must have obsolete enabled to change topics')) if not topic and not clear: raise error.Abort('changing topic requires a topic name or --clear') - if any(not c.mutable() for c in repo.set('%r and public()', change)): + if any(not c.mutable() for c in repo.set('%r and public()', rev)): raise error.Abort("can't change topic of a public change") - _changetopics(ui, repo, change, topic, clear) + _changetopics(ui, repo, rev, topic, clear) if clear: if repo.vfs.exists('topic'): repo.vfs.unlink('topic')
--- a/tests/test-topic.t Wed Jun 21 01:05:46 2017 +0530 +++ b/tests/test-topic.t Wed Jun 21 02:00:01 2017 +0530 @@ -22,9 +22,9 @@ options: - --clear clear active topic if any - --change VALUE revset of existing revisions to change topic - -l --list show the stack of changeset in the topic + --clear clear active topic if any + -r --rev REV revset of existing revisions + -l --list show the stack of changeset in the topic (some details hidden, use --verbose to show complete help) $ hg topics @@ -32,8 +32,8 @@ Test topics interaction with evolution: $ hg topics --config experimental.evolution= - $ hg topics --config experimental.evolution= --change . bob - abort: must have obsolete enabled to use --change + $ hg topics --config experimental.evolution= --rev . bob + abort: must have obsolete enabled to change topics [255] Create some changes: @@ -542,17 +542,17 @@ $ hg topics fran Changing topic fails if we don't give a topic - $ hg topic --change 9 + $ hg topic --rev 9 abort: changing topic requires a topic name or --clear [255] Can't change topic of a public change - $ hg topic --change 1:: --clear + $ hg topic --rev 1:: --clear abort: can't change topic of a public change [255] Can clear topics - $ hg topic --change 9 --clear + $ hg topic --rev 9 --clear changed topic on 1 changes please run hg evolve --rev "not topic()" now $ hg log -Gr 'draft() and not obsolete()' @@ -577,7 +577,7 @@ rebasing 10:4073470c35e1 "fran?" Can add a topic to an existing change - $ hg topic --change 11 wat + $ hg topic --rev 11 wat changed topic on 1 changes please run hg evolve --rev "topic(wat)" now $ hg log -Gr 'draft() and not obsolete()' @@ -651,8 +651,8 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: fran? -Readding the same topic with topic --change should work: - $ hg topic --change . watwat +Reading the same topic with topic --rev should work: + $ hg topic --rev . watwat changed topic on 1 changes Testing issue5441 @@ -675,7 +675,7 @@ | summary: start on fran | - $ hg topics --change '13::19' changewat + $ hg topics --rev '13::19' changewat changed topic on 2 changes please run hg evolve --rev "topic(changewat)" now $ hg log -Gr 'draft()'