changeset 20432:1b926f0bbf8a

push: move obsolescence marker exchange in the exchange module The obsolescence marker exchange code was already extracted during a previous cycle. We are moving the extracted functio in this module. This function will read and write data in the `pushoperation` object and I prefer to have all core function collaborating through this object in the same place. This changeset is pure code movement only. Code change for direct consumption of the `pushoperation` object will come later.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Jan 2014 17:54:47 -0800
parents bebf8b8479f3
children 6af248474224
files mercurial/exchange.py mercurial/obsolete.py
diffstat 2 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Jan 30 17:51:41 2014 -0800
+++ b/mercurial/exchange.py	Thu Jan 30 17:54:47 2014 -0800
@@ -247,7 +247,7 @@
                         pushop.ui.warn(_('updating %s to public failed!\n')
                                        % newremotehead)
             pushop.ui.debug('try to push obsolete markers to remote\n')
-            obsolete.syncpush(pushop.repo, pushop.remote)
+            _pushobsolete(pushop.repo, pushop.remote)
         finally:
             if lock is not None:
                 lock.release()
@@ -258,6 +258,22 @@
     _pushbookmark(pushop)
     return ret
 
+def _pushobsolete(repo, remote):
+    """utility function to push obsolete markers to a remote
+
+    Exist mostly to allow overriding for experimentation purpose"""
+    if (obsolete._enabled and repo.obsstore and
+        'obsolete' in remote.listkeys('namespaces')):
+        rslts = []
+        remotedata = repo.listkeys('obsolete')
+        for key in sorted(remotedata, reverse=True):
+            # reverse sort to ensure we end with dump0
+            data = remotedata[key]
+            rslts.append(remote.pushkey('obsolete', key, '', data))
+        if [r for r in rslts if not r]:
+            msg = _('failed to push some obsolete markers!\n')
+            repo.ui.warn(msg)
+
 def _pushbookmark(pushop):
     """Update bookmark position on remote"""
     ui = pushop.ui
--- a/mercurial/obsolete.py	Thu Jan 30 17:51:41 2014 -0800
+++ b/mercurial/obsolete.py	Thu Jan 30 17:54:47 2014 -0800
@@ -384,22 +384,6 @@
     finally:
         lock.release()
 
-def syncpush(repo, remote):
-    """utility function to push obsolete markers to a remote
-
-    Exist mostly to allow overriding for experimentation purpose"""
-    if (_enabled and repo.obsstore and
-        'obsolete' in remote.listkeys('namespaces')):
-        rslts = []
-        remotedata = repo.listkeys('obsolete')
-        for key in sorted(remotedata, reverse=True):
-            # reverse sort to ensure we end with dump0
-            data = remotedata[key]
-            rslts.append(remote.pushkey('obsolete', key, '', data))
-        if [r for r in rslts if not r]:
-            msg = _('failed to push some obsolete markers!\n')
-            repo.ui.warn(msg)
-
 def syncpull(repo, remote, gettransaction):
     """utility function to pull obsolete markers from a remote