sapling/tests/fakedate.py
Mark Thomas a3c411c1e8 commitcloud: omit older commits when pulling during sync
Summary:
Add a new config option: `commitcloud.max_sync_age`.  When set, commit cloud
will not pull in any commits that are older than this when it is joining or
syncing.  The commits are still nominally in the cloud workspace, we just
save join or sync time by not including the commits.

Reviewed By: liubov-dmitrieva

Differential Revision: D13062470

fbshipit-source-id: 17a4bdb4095766a83a4bf6d4151ae86b39edf59c
2018-11-15 12:16:19 -08:00

22 lines
454 B
Python

import datetime
import time
from mercurial import util
def extsetup(ui):
fakedate = ui.config("fakedate", "date", "1996-03-07 14:00:01Z")
fakedate = util.parsedate(fakedate)[0]
class fakedatetime(datetime.datetime):
@staticmethod
def now(tz=None):
return datetime.datetime.fromtimestamp(fakedate, tz)
datetime.datetime = fakedatetime
def faketime():
return fakedate
time.time = faketime