tests/testlib/ext-stream-clone-steps.py
author Anton Shestakov <av6@dwimlabs.net>
Thu, 05 Oct 2023 14:47:42 -0300
branchstable
changeset 50990 758e40b9a8af
parent 50624 c2633c69cbe0
permissions -rw-r--r--
httppeer: fix static-http: scheme autodetection (issue6833) Since statichttprepo.make_peer() assumes path is a urlutil.path object (by accessing path.loc), we no longer can just provide a bytestring there. See also 5f71fff8dc74 and cfe8d88a453e.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50624
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     1
# A utility extension that help taking a break during streamclone operation
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     2
#
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     3
# This extension is used through two environment variable
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     4
#
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     5
# HG_TEST_STREAM_WALKED_FILE_1
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     6
#
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     7
#   path of a file created by the process generating the streaming clone when
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     8
#   it is done gathering data and is ready to unlock the repository and move
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
     9
#   to the streaming of content.
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    10
#
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    11
# HG_TEST_STREAM_WALKED_FILE_2
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    12
#
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    13
#   path of a file to be manually created to let the process generating the
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    14
#   streaming clone proceed to streaming file content.
c2633c69cbe0 stream-clone: document the ext-stream-clone-steps.py utility extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48875
diff changeset
    15
46986
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    16
from mercurial import (
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    17
    encoding,
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    18
    extensions,
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    19
    streamclone,
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    20
    testing,
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    21
)
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    22
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    23
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    24
WALKED_FILE_1 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_1']
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    25
WALKED_FILE_2 = encoding.environ[b'HG_TEST_STREAM_WALKED_FILE_2']
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    26
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    27
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    28
def _test_sync_point_walk_1(orig, repo):
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    29
    testing.write_file(WALKED_FILE_1)
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    30
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    31
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    32
def _test_sync_point_walk_2(orig, repo):
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    33
    assert repo._currentlock(repo._lockref) is None
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    34
    testing.wait_file(WALKED_FILE_2)
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    35
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    36
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    37
def uisetup(ui):
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    38
    extensions.wrapfunction(
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    39
        streamclone, '_test_sync_point_walk_1', _test_sync_point_walk_1
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    40
    )
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    41
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    42
    extensions.wrapfunction(
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    43
        streamclone, '_test_sync_point_walk_2', _test_sync_point_walk_2
faa43f09ad98 streamclone: remove sleep based "synchronisation" in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
    44
    )