mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
e0bc41e10b
Summary: Set default commit timezone to UTC to avoid time missmatches. While running tests I noticed that the times didn't match: ``` buck test //eden/scm/tests:hg_run_py_tests File changed: fbcode//eden/scm/tests/diff/hashes.py waiting for all tests to finish... ✗ Fail: eden/scm/tests:hg_run_py_tests - test_diff_hashes (eden.scm.tests.diff.hashes.TestDiffHashes) (0.0s) AssertionError: '--- [27 chars]1970 -0800\n+++ b/foo\tThu Jan 01 00:00:00 197[37 chars]ar\n' != '--- [27 chars]1970 +0000\n+++ b/foo\tThu Jan 01 00:00:00 197[37 chars]ar\n' - --- a/fooThu Jan 01 00:00:00 1970 -0800 ? ^ ^ + --- a/fooThu Jan 01 00:00:00 1970 +0000 ? ^ ^ - +++ b/fooThu Jan 01 00:00:00 1970 -0800 ? ^ ^ + +++ b/fooThu Jan 01 00:00:00 1970 +0000 ? ^ ^ ``` Although ususally we won't be looking to time, make sure that it is set it to as specific a value as possible. Reviewed By: sggutier Differential Revision: D37174200 fbshipit-source-id: c9b024f19ade3ce3ffb341f7da263e4dd51a8f31
29 lines
639 B
Python
29 lines
639 B
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# pyre-strict
|
|
|
|
from typing import Dict
|
|
|
|
|
|
class RepoGenerator:
|
|
_commits: int
|
|
_files: int
|
|
|
|
def __init__(self) -> None:
|
|
self._commits = 0
|
|
self._files = 0
|
|
|
|
def gen_commit_data(self) -> Dict[str, str]:
|
|
self._commits += 1
|
|
return {
|
|
"message": f"message{self._commits}",
|
|
"date": "1970-01-01 UTC",
|
|
}
|
|
|
|
def gen_file_name(self) -> str:
|
|
self._files += 1
|
|
return f"file{self._files}"
|