destination: make sure 'setupdest' is the latest function in the module
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 30 Mar 2016 03:12:43 -0700
changeset 1938 7e31d3e79806
parent 1937 60b7de2b3dd1
child 1939 4268fdd11b74
destination: make sure 'setupdest' is the latest function in the module Let's introduce some consistency, end of module seems fine.
hgext3rd/topic/destination.py
--- a/hgext3rd/topic/destination.py	Wed Mar 30 03:45:29 2016 -0700
+++ b/hgext3rd/topic/destination.py	Wed Mar 30 03:12:43 2016 -0700
@@ -68,21 +68,6 @@
         return revs.min()
     return None
 
-def setupdest():
-    if util.safehasattr(destutil, '_destmergebranch'):
-        extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
-    rebase = extensions.find('rebase')
-    if (util.safehasattr(rebase, '_destrebase')
-            # logic not shared with merge yet < hg-3.8
-            and not util.safehasattr(rebase, '_definesets')):
-        extensions.wrapfunction(rebase, '_destrebase', _destmergebranch)
-    if util.safehasattr(destutil, 'destupdatesteps'):
-        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"""
     ## search for untopiced heads of branch
@@ -100,3 +85,18 @@
     if not all:
         subquery = 'max(%s)' % subquery
     return repo.revs(subquery, branch, branch, branch)
+
+def setupdest():
+    if util.safehasattr(destutil, '_destmergebranch'):
+        extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
+    rebase = extensions.find('rebase')
+    if (util.safehasattr(rebase, '_destrebase')
+            # logic not shared with merge yet < hg-3.8
+            and not util.safehasattr(rebase, '_definesets')):
+        extensions.wrapfunction(rebase, '_destrebase', _destmergebranch)
+    if util.safehasattr(destutil, 'destupdatesteps'):
+        bridx = destutil.destupdatesteps.index('branch')
+        destutil.destupdatesteps.insert(bridx, 'topic')
+        destutil.destupdatestepmap['topic'] = _destupdatetopic
+    if util.safehasattr(destutil, 'desthistedit'):
+        extensions.wrapfunction(destutil, 'desthistedit', desthistedit)