Skip to content
Snippets Groups Projects
Commit 734207ba authored by Antoine Lambert's avatar Antoine Lambert
Browse files

rlog: Skip rlog entry with missing header in RlogConv.parse_rlog

CVS rlog for a given module sent by server is a concatenation of
rlog entries. Each entry has a header containing the path to a
RCS file plus other info.

It exist cases where a rlog entry header is empty which makes the
rlog parsing fail.

So instead of stopping rlog parsing by raising an exception, prefer
to skip that entry and process the next one.

Closes T4629
parent cfe7507a
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,7 @@
import calendar
from collections import defaultdict
import logging
import re
import string
import time
......@@ -53,6 +54,8 @@ from typing import BinaryIO, Dict, List, NamedTuple, Optional, Tuple
from swh.loader.cvs.cvs2gitdump.cvs2gitdump import ChangeSetKey
logger = logging.getLogger(__name__)
class revtuple(NamedTuple):
number: str
......@@ -217,7 +220,9 @@ class RlogConv:
if filename:
path = filename
elif not eof:
raise ValueError("No filename found in rlog header")
logger.warning(
"No filename found in rlog header, skipping associated entry"
)
while not eof:
off = fp.tell()
rev, logmsg, eof = _parse_log_entry(fp)
......@@ -230,7 +235,8 @@ class RlogConv:
if rev:
self.offsets[path][rev[0]] = off
self._process_rlog_revisions(path, taginfo, revisions, logmsgs)
if path:
self._process_rlog_revisions(path, taginfo, revisions, logmsgs)
def getlog(self, fp: BinaryIO, path: bytes, rev: str) -> Optional[bytes]:
off = self.offsets[path][rev]
......
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