--- a/src/topic/__init__.py Wed Jun 10 15:03:39 2015 -0400
+++ b/src/topic/__init__.py Wed Jun 10 16:13:20 2015 -0400
@@ -19,6 +19,7 @@
from mercurial import phases
from mercurial import util
+from . import constants
from . import revset as topicrevset
cmdtable = {}
@@ -30,7 +31,7 @@
def _nodemap(repo, node):
ctx = repo[node]
- t = ctx.extra().get('topic', '')
+ t = ctx.extra().get(constants.extrakey, '')
if t and ctx.phase() > phases.public:
return [t]
return []
@@ -41,14 +42,14 @@
def commitctx(self, ctx, error=None):
current = self.currenttopic
if current:
- ctx.extra()['topic'] = current
+ ctx.extra()[constants.extrakey] = current
return orig.commitctx(self, ctx, error=error)
@property
def topics(self):
topics = set(['', self.currenttopic])
for c in self.set('not public()'):
- topics.add(c.extra().get('topic', ''))
+ topics.add(c.extra().get(constants.extrakey, ''))
topics.remove('')
return topics
@@ -85,12 +86,12 @@
return None
fixedextra = dict(c.extra())
newtopic = None if clear else topic
- if fixedextra.get('topic', None) == topic:
+ if fixedextra.get(constants.extrakey, None) == topic:
continue
- if clear and 'topic' in fixedextra:
- del fixedextra['topic']
+ if clear and constants.extrakey in fixedextra:
+ del fixedextra[constants.extrakey]
else:
- fixedextra['topic'] = topic
+ fixedextra[constants.extrakey] = topic
c.parents()
mc = context.memctx(
repo, (c.p1().node(), c.p2().node()), c.description(),
@@ -125,7 +126,7 @@
repo.vfs.unlink('topic')
else:
# inherit the topic of the parent revision
- t = pctx.extra().get('topic', '')
+ t = pctx.extra().get(constants.extrakey, '')
if t and pctx.phase() > phases.public:
with repo.vfs.open('topic', 'w') as f:
f.write(t)