[PATCH 3 of 5 topic-experiment] topics: drop the clean argument from _changetopics()
Pulkit Goyal
7895pulkit at gmail.com
Tue Jun 20 22:09:24 EDT 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1497995905 -19800
# Wed Jun 21 03:28:25 2017 +0530
# Node ID 06359d495ef9cc44163a35e16ca763148053e69c
# Parent 22705ee4a0f7a049dfd18063b5410ef72c55393c
topics: drop the clean argument from _changetopics()
After this commit, None will represent that we want to clean the topic.
diff --git a/hgext3rd/topic/__init__.py b/hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py
+++ b/hgext3rd/topic/__init__.py
@@ -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):
More information about the Mercurial-devel
mailing list