--- a/hgext3rd/topic/destination.py Sun Aug 14 19:57:58 2016 +0200
+++ b/hgext3rd/topic/destination.py Tue Aug 16 15:32:54 2016 +0200
@@ -8,6 +8,7 @@
extensions,
util,
)
+from . import topicmap
from .evolvebits import builddependencies
def _destmergebranch(orig, repo, action='merge', sourceset=None,
@@ -40,7 +41,7 @@
if not bhead:
raise error.NoMergeDestAbort(_("nothing to merge"))
elif 1 == len(bhead):
- return bhead.first()
+ return bhead[0]
else:
msg = _("branch '%s' has %d heads "
"- please merge with an explicit rev")
@@ -88,16 +89,14 @@
# but that is expensive
#
# we should write plain code instead
- subquery = '''heads(
- parents(
- ancestor(
- (head() and branch(%s)
- or (topic() and branch(%s)))))
- ::(head() and branch(%s))
- - topic())'''
- if not all:
- subquery = 'max(%s)' % subquery
- return repo.revs(subquery, branch, branch, branch)
+ with topicmap.usetopicmap(repo):
+ tmap = repo.branchmap()
+ if branch not in tmap:
+ return []
+ elif all:
+ return tmap.branchheads(branch)
+ else:
+ return [tmap.branchtip(branch)]
def modsetup(ui):
"""run a uisetup time to install all destinations wrapping"""