mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
obsolete: extract obsolescence marker pushing into a dedicated function
Having a dedicated function will allows us to experiment with other exchange strategies in an extension. As we have no solid clues about how to do it right, being able to experiment is vital. I intended a more ambitious extraction of push logic, but we are far too advanced in the release cycle for it.
This commit is contained in:
parent
eed131db97
commit
0a4431da48
@ -1912,17 +1912,7 @@ class localrepository(object):
|
||||
self.ui.warn(_('updating %s to public failed!\n')
|
||||
% newremotehead)
|
||||
self.ui.debug('try to push obsolete markers to remote\n')
|
||||
if (obsolete._enabled and self.obsstore and
|
||||
'obsolete' in remote.listkeys('namespaces')):
|
||||
rslts = []
|
||||
remotedata = self.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')
|
||||
self.ui.warn(msg)
|
||||
obsolete.syncpush(self, remote)
|
||||
finally:
|
||||
if lock is not None:
|
||||
lock.release()
|
||||
|
@ -370,6 +370,22 @@ def pushmarker(repo, key, old, new):
|
||||
finally:
|
||||
lock.release()
|
||||
|
||||
def syncpush(repo, remote):
|
||||
"""utility function to push bookmark to a remote
|
||||
|
||||
Exist mostly to allow overridding 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 allmarkers(repo):
|
||||
"""all obsolete markers known in a repository"""
|
||||
for markerdata in repo.obsstore:
|
||||
|
Loading…
Reference in New Issue
Block a user