changegroup: pass function to resolve delta parents into constructor
Previously, _deltaparent() encapsulated the logic for all 3
delta parent modes of operation. The choice of delta parent
is static for the lifetime of the packer and can be passed into
the packer as a callable. So do that.
Differential Revision: https://phab.mercurial-scm.org/D4132
from __future__ import absolute_import
import os
import time
class mocktime(object):
def __init__(self, increment):
self.time = 0
self.increment = [float(s) for s in increment.split()]
self.pos = 0
def __call__(self):
self.time += self.increment[self.pos % len(self.increment)]
self.pos += 1
return self.time
def uisetup(ui):
time.time = mocktime(os.environ.get('MOCKTIME', '0.1'))