Authors file not read in binary mode, causing errors on further lines.
I am using hg-git with Python 3.7.3, on Windows.
I have an authors
file referred to by hgrc
and got the following error when performing hg push
:
File "C:\Python37x64\lib\site-packages\mercurial\commands.py", line 5778, in push
opargs=opargs,
File "D:/dev/OSS/hg-git\hggit\util.py", line 63, in inner
return f(*args, **kwargs)
File "D:/dev/OSS/hg-git\hggit\__init__.py", line 585, in exchangepush
pushop.cgresult = repo.githandler.push(remote.path, revs, force)
File "C:\Python37x64\lib\site-packages\mercurial\util.py", line 1762, in __get__
result = self.func(obj)
File "D:/dev/OSS/hg-git\hggit\hgrepo.py", line 46, in githandler
return GitHandler(self, self.ui)
File "D:/dev/OSS/hg-git\hggit\git_handler.py", line 145, in __init__
self.init_author_file()
File "D:/dev/OSS/hg-git\hggit\git_handler.py", line 206, in init_author_file
if not line or line.startswith(b'#'):
TypeError: startswith first arg must be str or a tuple of str, not bytes
I changed:
with open(self.repo.wvfs.join(authors_path)) as f:
to
with open(self.repo.wvfs.join(authors_path), "rb") as f:
and it worked.