diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -575,9 +575,9 @@ if gid is None: gid = os.getgid() try: - return grp.getgrgid(gid)[0] + return pycompat.fsencode(grp.getgrgid(gid)[0]) except KeyError: - return str(gid) + return pycompat.bytestr(gid) def groupmembers(name): """Return the list of members of the group with the given