diff mercurial/exchange.py @ 43661:32048206e7be

merge with stable
author Yuya Nishihara <yuya@tcha.org>
date Fri, 15 Nov 2019 22:22:55 +0900
parents 4d8a4ecbb8b9 e513e87b0476
children 27c6d6f53d46
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Nov 14 20:40:54 2019 -0800
+++ b/mercurial/exchange.py	Fri Nov 15 22:22:55 2019 +0900
@@ -28,6 +28,7 @@
     logexchange,
     narrowspec,
     obsolete,
+    obsutil,
     phases,
     pushkey,
     pycompat,
@@ -99,11 +100,6 @@
     contentopts = attr.ib()
 
 
-def _sortedmarkers(markers):
-    # last item of marker tuple ('parents') may be None or a tuple
-    return sorted(markers, key=lambda m: m[:-1] + (m[-1] or (),))
-
-
 def parsebundlespec(repo, spec, strict=True):
     """Parse a bundle string specification into parts.
 
@@ -1140,7 +1136,7 @@
         return
     pushop.stepsdone.add(b'obsmarkers')
     if pushop.outobsmarkers:
-        markers = _sortedmarkers(pushop.outobsmarkers)
+        markers = obsutil.sortedmarkers(pushop.outobsmarkers)
         bundle2.buildobsmarkerspart(bundler, markers)
 
 
@@ -1475,7 +1471,7 @@
     if pushop.outobsmarkers:
         pushop.ui.debug(b'try to push obsolete markers to remote\n')
         rslts = []
-        markers = _sortedmarkers(pushop.outobsmarkers)
+        markers = obsutil.sortedmarkers(pushop.outobsmarkers)
         remotedata = obsolete._pushkeyescape(markers)
         for key in sorted(remotedata, reverse=True):
             # reverse sort to ensure we end with dump0
@@ -2573,7 +2569,7 @@
             heads = repo.heads()
         subset = [c.node() for c in repo.set(b'::%ln', heads)]
         markers = repo.obsstore.relevantmarkers(subset)
-        markers = _sortedmarkers(markers)
+        markers = obsutil.sortedmarkers(markers)
         bundle2.buildobsmarkerspart(bundler, markers)