annotate tests/mocktime.py @ 38679:b3d0c97a0820

rebase: in --confirm option just abort if hit a conflict Before this patch, it was prompting the user in both cases 1) when there is no conflict 2) when there is at least one conflict. But for simplicity we can just abort if we hit a conflict and no need to prompt in that case. Differential Revision: https://phab.mercurial-scm.org/D3944
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 14 Jul 2018 08:59:42 +0530
parents 12b355964de8
children 2372284d9457
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34316
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
1 from __future__ import absolute_import
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
2
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
3 import os
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
4 import time
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
5
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
6 class mocktime(object):
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
7 def __init__(self, increment):
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
8 self.time = 0
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
9 self.increment = [float(s) for s in increment.split()]
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
10 self.pos = 0
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
11
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
12 def __call__(self):
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
13 self.time += self.increment[self.pos % len(self.increment)]
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
14 self.pos += 1
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
15 return self.time
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
16
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
17 def uisetup(ui):
12b355964de8 test-patchbomb: use mocktime
Jun Wu <quark@fb.com>
parents:
diff changeset
18 time.time = mocktime(os.environ.get('MOCKTIME', '0.1'))