📄 externals_tests.py
字号:
"update to receive a new external module"
externals_test_setup(sbox)
wc_dir = sbox.wc_dir
other_wc_dir = sbox.add_wc_path('other')
repo_dir = sbox.repo_dir
repo_url = sbox.repo_url
other_repo_url = repo_url + ".other"
# Checkout two working copies.
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, wc_dir)
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, other_wc_dir)
# Add one new external item to the property on A/D. The new item is
# "exdir_E", deliberately added in the middle not at the end.
new_externals_desc = \
"exdir_A " + other_repo_url + "/A" + \
"\n" + \
"exdir_A/G " + other_repo_url + "/A/D/G" + \
"\n" + \
"exdir_E " + other_repo_url + "/A/B/E" + \
"\n" + \
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
"\n" + \
"x/y/z/blah " + other_repo_url + "/A/B/E" + \
"\n"
# Set and commit the property
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
# Update the other working copy, see if we get the new item.
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
exdir_E_path = os.path.join(other_wc_dir, "A", "D", "exdir_E")
if (not os.path.exists(exdir_E_path)):
raise svntest.Failure("Probing for " + exdir_E_path + " failed.")
#----------------------------------------------------------------------
def update_lose_external(sbox):
"update to lose an external module"
externals_test_setup(sbox)
wc_dir = sbox.wc_dir
other_wc_dir = sbox.add_wc_path('other')
repo_dir = sbox.repo_dir
repo_url = sbox.repo_url
other_repo_url = repo_url + ".other"
# Checkout two working copies.
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, wc_dir)
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, other_wc_dir)
# Lose one new external item from A/D. The lost item is
# "exdir_A", chosen because there are two other externals underneath
# it (G and H) which are not being removed. We expect them to
# remain -- in other words:
#
# BEFORE AFTER
# ------------ ------------
# A/D/exdir_A A/D/exdir_A
# A/D/exdir_A/.svn/... <GONE>
# A/D/exdir_A/mu <GONE>
# A/D/exdir_A/B/... <GONE>
# A/D/exdir_A/C/... <GONE>
# A/D/exdir_A/D/... <GONE>
# A/D/exdir_A/G/... A/D/exdir_A/G/...
# A/D/exdir_A/H/... A/D/exdir_A/H/...
new_externals_desc = \
"exdir_A/G " + other_repo_url + "/A/D/G" + \
"\n" + \
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
"\n" + \
"x/y/z/blah " + other_repo_url + "/A/B/E" + \
"\n"
# Set and commit the property
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
# Update other working copy, see if lose & preserve things appropriately
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
exdir_A_path = os.path.join(other_wc_dir, "A", "D", "exdir_A")
if (not os.path.exists(exdir_A_path)):
raise svntest.Failure("Probing for " + exdir_A_path + " failed.")
mu_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "mu")
if (os.path.exists(mu_path)):
raise svntest.Failure(mu_path + " unexpectedly still exists.")
B_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "B")
if (os.path.exists(B_path)):
raise svntest.Failure(B_path + " unexpectedly still exists.")
C_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "C")
if (os.path.exists(C_path)):
raise svntest.Failure(C_path + " unexpectedly still exists.")
D_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "D")
if (os.path.exists(D_path)):
raise svntest.Failure(D_path + " unexpectedly still exists.")
G_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "G")
if (not os.path.exists(G_path)):
raise svntest.Failure("Probing for " + G_path + " failed.")
H_path = os.path.join(other_wc_dir, "A", "D", "exdir_A", "H")
if (not os.path.exists(H_path)):
raise svntest.Failure("Probing for " + H_path + " failed.")
#----------------------------------------------------------------------
def update_change_pristine_external(sbox):
"update change to an unmodified external module"
externals_test_setup(sbox)
wc_dir = sbox.wc_dir
other_wc_dir = sbox.add_wc_path('other')
repo_dir = sbox.repo_dir
repo_url = sbox.repo_url
other_repo_url = repo_url + ".other"
# Checkout two working copies.
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, wc_dir)
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, other_wc_dir)
# Change the "x/y/z/blah" external on A/D to point to a different
# URL. Since no changes were made to the old checked-out external,
# we should get a clean replace.
new_externals_desc = \
"exdir_A " + other_repo_url + "/A" + \
"\n" + \
"exdir_A/G " + other_repo_url + "/A/D/G" + \
"\n" + \
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
"\n" + \
"x/y/z/blah " + other_repo_url + "/A/B/F" + \
"\n"
# Set and commit the property
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
# Update other working copy, see if get the right change.
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
xyzb_path = os.path.join(other_wc_dir, "x", "y", "z", "blah")
alpha_path = os.path.join(xyzb_path, "alpha")
if (os.path.exists(alpha_path)):
raise svntest.Failure(alpha_path + " unexpectedly still exists.")
beta_path = os.path.join(xyzb_path, "beta")
if (os.path.exists(beta_path)):
raise svntest.Failure(beta_path + " unexpectedly still exists.")
def update_change_modified_external(sbox):
"update changes to a modified external module"
externals_test_setup(sbox)
wc_dir = sbox.wc_dir
other_wc_dir = sbox.add_wc_path('other')
repo_dir = sbox.repo_dir
repo_url = sbox.repo_url
other_repo_url = repo_url + ".other"
# Checkout two working copies.
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, wc_dir)
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
'--username', svntest.main.wc_author,
'--password', svntest.main.wc_passwd,
repo_url, other_wc_dir)
# Make a couple of mods in the "x/y/z/blah/" external.
alpha_path = os.path.join(other_wc_dir, "A", "D",
"x", "y", "z", "blah", "alpha")
svntest.main.file_append(alpha_path, "\nSome new text in alpha.")
new_file = os.path.join(other_wc_dir, "A", "D",
"x", "y", "z", "blah", "fish.txt")
svntest.main.file_append(new_file, "This is an unversioned file.")
# Change the "x/y/z/blah" external on A/D to point to a different
# URL. There are some local mods under the old checked-out external,
# so the old dir should be saved under a new name.
new_externals_desc = \
"exdir_A " + other_repo_url + "/A" + \
"\n" + \
"exdir_A/G " + other_repo_url + "/A/D/G" + \
"\n" + \
"exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
"\n" + \
"x/y/z/blah " + other_repo_url + "/A/B/F" + \
"\n"
# Set and commit the property
change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
# Update other working copy, see if get the right change.
svntest.actions.run_and_verify_svn("", None, [], 'up', other_wc_dir)
xyzb_path = os.path.join(other_wc_dir, "x", "y", "z", "blah")
alpha_path = os.path.join(xyzb_path, "alpha")
if (os.path.exists(alpha_path)):
raise svntest.Failure(alpha_path + " unexpectedly still exists.")
beta_path = os.path.join(xyzb_path, "beta")
if (os.path.exists(beta_path)):
raise svntest.Failure(beta_path + " unexpectedly still exists.")
def update_receive_change_under_external(sbox):
"update changes under an external module"
externals_test_setup(sbox)
wc_dir = sbox.wc_dir
other_wc_dir = sbox.add_wc_path('other')
repo_dir = sbox.repo_dir
repo_url = sbox.repo_url
other_repo_url = repo_url + ".other"
# Checkout two working copies.
svntest.actions.run_and_verify_svn("", None, [],
'checkout',
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -