Skip to content
Snippets Groups Projects
Commit 34f46486 authored by Stefan Sperling's avatar Stefan Sperling
Browse files

preserve empty lines in CVS log messages over pserver

Empty lines sent by the CVS server in rlog output were being stripped
by our custom cvs client implementation. Unfortunately, this resulted
in empty lines being stripped from CVS log messages, which is fixed
with this commit. The rsync access method already preserved log
messages properly, and now the pserver access method does the same.
parent f5b974a0
No related branches found
No related tags found
1 merge request!27preserve empty lines in CVS log messages over pserver
......@@ -271,8 +271,6 @@ class CVSClient:
raise CVSProtocolError("CVS server error: %s" % line)
if line == b"ok\n":
break
elif line == b"M \n":
continue
elif line[0:2] == b"M ":
rlog_output.write(line[2:])
elif line[0:8] == b"MT text ":
......
......@@ -350,7 +350,9 @@ def _parse_log_header(
state = 0
if state == 0:
if line[:9] == b"RCS file:":
if line == "\n":
continue
elif line[:9] == b"RCS file:":
filename = line[10:-1]
elif line[:5] == b"head:":
# head = line[6:-1]
......
File added
......@@ -709,3 +709,91 @@ def test_loader_cvs_pserver_split_commits_by_commitid(swh_storage, datadir, tmp_
"skipped_content": 0,
"snapshot": 18,
}
GREEK_SNAPSHOT6 = Snapshot(
id=hash_to_bytes("b4c9423b2711c181251deb458d4ab4a3172948ac"),
branches={
b"HEAD": SnapshotBranch(
target=hash_to_bytes("f317c720e1929fec0afce10e6a8cfd24ef76dfc7"),
target_type=TargetType.REVISION,
)
},
)
def test_loader_cvs_empty_lines_in_log_message(swh_storage, datadir, tmp_path):
"""Conversion of RCS history with empty lines in a log message"""
archive_name = "greek-repository6"
extracted_name = "greek-repository"
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, extracted_name, tmp_path)
repo_url += "/greek-tree" # CVS module name
loader = CvsLoader(
swh_storage, repo_url, cvsroot_path=os.path.join(tmp_path, extracted_name)
)
assert loader.load() == {"status": "eventful"}
assert_last_visit_matches(
loader.storage,
repo_url,
status="full",
type="cvs",
snapshot=GREEK_SNAPSHOT6.id,
)
check_snapshot(GREEK_SNAPSHOT6, loader.storage)
stats = get_stats(loader.storage)
assert stats == {
"content": 9,
"directory": 22,
"origin": 1,
"origin_visit": 1,
"release": 0,
"revision": 8,
"skipped_content": 0,
"snapshot": 8,
}
def test_loader_cvs_pserver_empty_lines_in_log_message(swh_storage, datadir, tmp_path):
"""Conversion via pserver with empty lines in a log message"""
archive_name = "greek-repository6"
extracted_name = "greek-repository"
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, extracted_name, tmp_path)
repo_url += "/greek-tree" # CVS module name
# Ask our cvsclient to connect via the 'cvs server' command
repo_url = f"fake://{repo_url[7:]}"
loader = CvsLoader(
swh_storage, repo_url, cvsroot_path=os.path.join(tmp_path, extracted_name)
)
assert loader.load() == {"status": "eventful"}
assert_last_visit_matches(
loader.storage,
repo_url,
status="full",
type="cvs",
snapshot=GREEK_SNAPSHOT6.id,
)
check_snapshot(GREEK_SNAPSHOT6, loader.storage)
stats = get_stats(loader.storage)
assert stats == {
"content": 9,
"directory": 22,
"origin": 1,
"origin_visit": 1,
"release": 0,
"revision": 8,
"skipped_content": 0,
"snapshot": 8,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment