tests/testlib/ext-stream-clone-steps.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sat, 26 Oct 2024 05:11:58 +0200
branchstable
changeset 52121 05bb54a3ef26
parent 50624 c2633c69cbe0
permissions -rw-r--r--
pycompat: filter more of the traceback in `test-flagproccessor.t` The traceback changes again with 3.13. So we filter it to only keeps the bits we care about. This is actually only reusing the approach from a few line below.
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
    )