Mercurial > evolve
diff hgext3rd/topic/__init__.py @ 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 |
line wrap: on
line diff
--- 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')