prev: add '_getcurrenttopic' helper and use it
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 14 Jul 2017 02:35:12 +0200
changeset 2742 64fb1a082f58
parent 2741 51d669b16fa8
child 2743 2fe562f94ead
prev: add '_getcurrenttopic' helper and use it We'll add more spot where this information is used.
hgext3rd/evolve/__init__.py
--- a/hgext3rd/evolve/__init__.py	Fri Jul 14 02:34:42 2017 +0200
+++ b/hgext3rd/evolve/__init__.py	Fri Jul 14 02:35:12 2017 +0200
@@ -1979,6 +1979,9 @@
 
 shorttemplate = "[{label('evolve.rev', rev)}] {desc|firstline}\n"
 
+def _getcurrenttopic(repo):
+    return getattr(repo, 'currenttopic', '')
+
 def _prevupdate(repo, displayer, target, bookmark, dryrun):
     if dryrun:
         repo.ui.write(('hg update %s;\n' % target.rev()))
@@ -2008,7 +2011,7 @@
     wkctx = repo[None]
     p1 = wkctx.parents()[0]
     parents = p1.parents()
-    currenttopic = getattr(repo, 'currenttopic', '')
+    currenttopic = _getcurrenttopic(repo)
     if currenttopic and topic:
         parents = [ctx for ctx in parents if ctx.topic() == currenttopic]