Submitter | Yuya Nishihara |
---|---|
Date | Feb. 3, 2018, 8:36 a.m. |
Message ID | <f4250fa75585535cd97f.1517646972@mimosa> |
Download | mbox | patch |
Permalink | /patch/27261/ |
State | Accepted |
Headers | show |
Comments
On Sat, Feb 3, 2018 at 12:36 AM, Yuya Nishihara <yuya@tcha.org> wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1517026189 -32400 > # Sat Jan 27 13:09:49 2018 +0900 > # Node ID f4250fa75585535cd97f378d27b4d999d4ccc359 > # Parent c8e2d6ed1f9ea4eee7b28250b5aff22433d538b6 > py3: replace "if ispy3" by encoding.strtolocal() > Queued this series. > > diff --git a/mercurial/lock.py b/mercurial/lock.py > --- a/mercurial/lock.py > +++ b/mercurial/lock.py > @@ -30,9 +30,7 @@ def _getlockprefix(): > confidence. Typically it's just hostname. On modern linux, we include > an > extra Linux-specific pid namespace identifier. > """ > - result = socket.gethostname() > - if pycompat.ispy3: > - result = result.encode(pycompat.sysstr(encoding.encoding), > 'replace') > + result = encoding.strtolocal(socket.gethostname()) > if pycompat.sysplatform.startswith('linux'): > try: > result += '/%x' % os.stat('/proc/self/ns/pid').st_ino > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1509,11 +1509,7 @@ class ui(object): > ''.join(exconly)) > else: > output = traceback.format_exception(exc[0], exc[1], > exc[2]) > - data = r''.join(output) > - if pycompat.ispy3: > - enc = pycompat.sysstr(encoding.encoding) > - data = data.encode(enc, errors=r'replace') > - self.write_err(data) > + self.write_err(encoding.strtolocal(r''.join(output))) > return self.tracebackflag or force > > def geteditor(self): > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel >
Patch
diff --git a/mercurial/lock.py b/mercurial/lock.py --- a/mercurial/lock.py +++ b/mercurial/lock.py @@ -30,9 +30,7 @@ def _getlockprefix(): confidence. Typically it's just hostname. On modern linux, we include an extra Linux-specific pid namespace identifier. """ - result = socket.gethostname() - if pycompat.ispy3: - result = result.encode(pycompat.sysstr(encoding.encoding), 'replace') + result = encoding.strtolocal(socket.gethostname()) if pycompat.sysplatform.startswith('linux'): try: result += '/%x' % os.stat('/proc/self/ns/pid').st_ino diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1509,11 +1509,7 @@ class ui(object): ''.join(exconly)) else: output = traceback.format_exception(exc[0], exc[1], exc[2]) - data = r''.join(output) - if pycompat.ispy3: - enc = pycompat.sysstr(encoding.encoding) - data = data.encode(enc, errors=r'replace') - self.write_err(data) + self.write_err(encoding.strtolocal(r''.join(output))) return self.tracebackflag or force def geteditor(self):