Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/cvs/loader.py
Show All 25 Lines | |||||
from swh.loader.cvs.cvs2gitdump.cvs2gitdump import ( | from swh.loader.cvs.cvs2gitdump.cvs2gitdump import ( | ||||
CHANGESET_FUZZ_SEC, | CHANGESET_FUZZ_SEC, | ||||
ChangeSetKey, | ChangeSetKey, | ||||
CvsConv, | CvsConv, | ||||
FileRevision, | FileRevision, | ||||
RcsKeywords, | RcsKeywords, | ||||
file_path, | file_path, | ||||
) | ) | ||||
from swh.loader.cvs.cvsclient import CVSClient, decode_path | from swh.loader.cvs.cvsclient import CVSClient, CVSProtocolError, decode_path | ||||
import swh.loader.cvs.rcsparse as rcsparse | import swh.loader.cvs.rcsparse as rcsparse | ||||
from swh.loader.cvs.rlog import RlogConv | from swh.loader.cvs.rlog import RlogConv | ||||
from swh.loader.exception import NotFound | from swh.loader.exception import NotFound | ||||
from swh.model import from_disk, hashutil | from swh.model import from_disk, hashutil | ||||
from swh.model.model import ( | from swh.model.model import ( | ||||
Content, | Content, | ||||
Directory, | Directory, | ||||
Person, | Person, | ||||
▲ Show 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | def prepare(self) -> None: | ||||
self.cvsclient = CVSClient(url) | self.cvsclient = CVSClient(url) | ||||
cvsroot_path = os.path.dirname(url.path) | cvsroot_path = os.path.dirname(url.path) | ||||
self.log.debug( | self.log.debug( | ||||
"Fetching CVS rlog from %s:%s/%s", | "Fetching CVS rlog from %s:%s/%s", | ||||
url.hostname, | url.hostname, | ||||
cvsroot_path, | cvsroot_path, | ||||
self.cvs_module_name, | self.cvs_module_name, | ||||
) | ) | ||||
self.rlog = RlogConv(cvsroot_path, CHANGESET_FUZZ_SEC) | try: | ||||
main_rlog_file = self.cvsclient.fetch_rlog() | main_rlog_file = self.cvsclient.fetch_rlog() | ||||
except CVSProtocolError as cvs_err: | |||||
if "cannot find module" in str(cvs_err): | |||||
raise NotFound( | |||||
f"CVS module named {self.cvs_module_name} cannot be found" | |||||
) | |||||
else: | |||||
raise | |||||
self.rlog = RlogConv(cvsroot_path, CHANGESET_FUZZ_SEC) | |||||
self.rlog.parse_rlog(main_rlog_file) | self.rlog.parse_rlog(main_rlog_file) | ||||
# Find file deletion events only visible in Attic directories. | # Find file deletion events only visible in Attic directories. | ||||
main_changesets = self.rlog.changesets | main_changesets = self.rlog.changesets | ||||
attic_paths = [] | attic_paths = [] | ||||
attic_rlog_files = [] | attic_rlog_files = [] | ||||
assert self.cvsroot_path | assert self.cvsroot_path | ||||
cvsroot_path_bytes = os.fsencode(self.cvsroot_path) | cvsroot_path_bytes = os.fsencode(self.cvsroot_path) | ||||
for k in main_changesets: | for k in main_changesets: | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |