# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1497995905 -19800 # Node ID 78de089a7830aa1d507bf1a44f4b4bc66e293f6a # Parent a9ca94defc29beb6dc063d1ad8ca4366592c65e3 topics: drop the clean argument from _changetopics() After this commit, None will represent that we want to clean the topic. diff -r a9ca94defc29 -r 78de089a7830 hgext3rd/topic/__init__.py --- 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):