hgext3rd/topic/destination.py
changeset 1911 442a7cb8404e
parent 1902 93cf0ddb5234
child 1912 692a1aa1350c
--- a/hgext3rd/topic/destination.py	Thu Mar 17 09:13:12 2016 -0700
+++ b/hgext3rd/topic/destination.py	Thu Mar 17 09:14:57 2016 -0700
@@ -55,6 +55,15 @@
         movemark = repo['.'].node()
     return node, movemark, None
 
+def desthistedit(orig, ui, repo):
+    if not (ui.config('histedit', 'defaultrev', None) is None
+            and repo.currenttopic):
+        return orig(ui, repo)
+    revs = repo.revs('::. and stack()')
+    if revs:
+        return revs.min()
+    return None
+
 def setupdest():
     if util.safehasattr(destutil, '_destmergebranch'):
         extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
@@ -67,6 +76,8 @@
         bridx = destutil.destupdatesteps.index('branch')
         destutil.destupdatesteps.insert(bridx, 'topic')
         destutil.destupdatestepmap['topic'] = _destupdatetopic
+    if util.safehasattr(destutil, 'desthistedit'):
+        extensions.wrapfunction(destutil, 'desthistedit', desthistedit)
 
 def ngtip(repo, branch, all=False):
     """tip new generation"""