File: ext-stream-clone-steps.py

package info (click to toggle)
mercurial 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,080 kB
  • sloc: python: 208,589; ansic: 56,460; tcl: 3,715; sh: 1,839; lisp: 1,483; cpp: 864; makefile: 769; javascript: 649; xml: 36
file content (55 lines) | stat: -rw-r--r-- 1,557 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# A utility extension that help taking a break during streamclone operation
#
# This extension is used through two environment variable
#
# HG_TEST_STREAM_WALKED_FILE_3
#
#   path of a file created by the process generating the streaming clone when
#   it is done gathering data and is ready to unlock the repository and move
#   to the streaming of content.
#
# HG_TEST_STREAM_WALKED_FILE_4
#
#   path of a file to be manually created to let the process generating the
#   streaming clone proceed to streaming file content.

from mercurial import (
    encoding,
    extensions,
    streamclone,
    testing,
)


WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1']
WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2']
WALKED_FILE_3 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_3']
WALKED_FILE_4 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_4']


def _test_sync_point_walk_1_2(orig, repo):
    testing.write_file(WALKED_FILE_1)
    testing.wait_file(WALKED_FILE_2)


def _test_sync_point_walk_3(orig, repo):
    testing.write_file(WALKED_FILE_3)


def _test_sync_point_walk_4(orig, repo):
    assert repo._currentlock(repo._lockref) is None
    testing.wait_file(WALKED_FILE_4)


def uisetup(ui):
    extensions.wrapfunction(
        streamclone, '_test_sync_point_walk_1_2', _test_sync_point_walk_1_2
    )

    extensions.wrapfunction(
        streamclone, '_test_sync_point_walk_3', _test_sync_point_walk_3
    )

    extensions.wrapfunction(
        streamclone, '_test_sync_point_walk_4', _test_sync_point_walk_4
    )