Mercurial > evolve
changeset 2644:78de089a7830
topics: drop the clean argument from _changetopics()
After this commit, None will represent that we want to clean the topic.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 21 Jun 2017 03:28:25 +0530 |
parents | a9ca94defc29 |
children | 2e3f63f4a519 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Wed Jun 21 02:00:01 2017 +0530 +++ b/hgext3rd/topic/__init__.py Wed Jun 21 03:28:25 2017 +0530 @@ -278,7 +278,10 @@ 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)): raise error.Abort("can't change topic of a public change") - _changetopics(ui, repo, rev, topic, clear) + if clear: + _changetopics(ui, repo, rev, None) + else: + _changetopics(ui, repo, rev, topic) if clear: if repo.vfs.exists('topic'): repo.vfs.unlink('topic') @@ -301,7 +304,7 @@ raise error.Abort(_('no active topic to list')) return stack.showstack(ui, repo, topic, opts) -def _changetopics(ui, repo, revset, topic, clear): +def _changetopics(ui, repo, revset, newtopic): rewrote = 0 needevolve = False l = repo.lock() @@ -320,14 +323,13 @@ fixedextra = dict(c.extra()) ui.debug('old node id is %s\n' % node.hex(c.node())) ui.debug('origextra: %r\n' % fixedextra) - newtopic = None if clear else topic oldtopic = fixedextra.get(constants.extrakey, None) if oldtopic == newtopic: continue - if clear: + if newtopic is None: del fixedextra[constants.extrakey] else: - fixedextra[constants.extrakey] = topic + fixedextra[constants.extrakey] = newtopic if 'amend_source' in fixedextra: # TODO: right now the commitctx wrapper in # topicrepo overwrites the topic in extra if @@ -372,7 +374,7 @@ lock.release(txn, l) ui.status('changed topic on %d changes\n' % rewrote) if needevolve: - evolvetarget = 'topic(%s)' % topic if topic else 'not topic()' + evolvetarget = 'topic(%s)' % newtopic if newtopic else 'not topic()' ui.status('please run hg evolve --rev "%s" now\n' % evolvetarget) def _listtopics(ui, repo, opts):