diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1799,6 +1799,7 @@ break if self.commenttext != "": - whitespaceremoved = re.sub("(?m)^\s.*(\n|$)", "", self.commenttext) + whitespaceremoved = re.sub(br"(?m)^\s.*(\n|$)", b"", + self.commenttext) if whitespaceremoved != "": self.opts['message'] = self.commenttext