| 1 |
# A utility extension that help taking a break during streamclone operation |
| 2 |
# |
| 3 |
# This extension is used through two environment variable |
| 4 |
# |
| 5 |
# HG_TEST_STREAM_WALKED_FILE_3 |
| 6 |
# |
| 7 |
# path of a file created by the process generating the streaming clone when |
| 8 |
# it is done gathering data and is ready to unlock the repository and move |
| 9 |
# to the streaming of content. |
| 10 |
# |
| 11 |
# HG_TEST_STREAM_WALKED_FILE_4 |
| 12 |
# |
| 13 |
# path of a file to be manually created to let the process generating the |
| 14 |
# streaming clone proceed to streaming file content. |
| 15 |
|
| 16 |
from mercurial import ( |
| 17 |
encoding, |
| 18 |
extensions, |
| 19 |
streamclone, |
| 20 |
testing, |
| 21 |
) |
| 22 |
|
| 23 |
|
| 24 |
WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1'] |
| 25 |
WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2'] |
| 26 |
WALKED_FILE_3 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_3'] |
| 27 |
WALKED_FILE_4 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_4'] |
| 28 |
|
| 29 |
|
| 30 |
def _test_sync_point_walk_1_2(orig, repo): |
| 31 |
testing.write_file(WALKED_FILE_1) |
| 32 |
testing.wait_file(WALKED_FILE_2) |
| 33 |
|
| 34 |
|
| 35 |
def _test_sync_point_walk_3(orig, repo): |
| 36 |
testing.write_file(WALKED_FILE_3) |
| 37 |
|
| 38 |
|
| 39 |
def _test_sync_point_walk_4(orig, repo): |
| 40 |
assert repo._currentlock(repo._lockref) is None |
| 41 |
testing.wait_file(WALKED_FILE_4) |
| 42 |
|
| 43 |
|
| 44 |
def uisetup(ui): |
| 45 |
extensions.wrapfunction( |
| 46 |
streamclone, '_test_sync_point_walk_1_2', _test_sync_point_walk_1_2 |
| 47 |
) |
| 48 |
|
| 49 |
extensions.wrapfunction( |
| 50 |
streamclone, '_test_sync_point_walk_3', _test_sync_point_walk_3 |
| 51 |
) |
| 52 |
|
| 53 |
extensions.wrapfunction( |
| 54 |
streamclone, '_test_sync_point_walk_4', _test_sync_point_walk_4 |
| 55 |
) |