Patchwork D3636: py3: use pycompat.fsencode() to convert user value to bytes

login
register
mail settings
Submitter phabricator
Date May 20, 2018, 1:40 p.m.
Message ID <differential-rev-PHID-DREV-ecxhzfc57wvihl6y2jvn-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31761/
State Superseded
Headers show

Comments

phabricator - May 20, 2018, 1:40 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3636

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
Yuya Nishihara - May 22, 2018, 11:06 a.m.
On Sun, 20 May 2018 13:40:10 +0000, pulkit (Pulkit Goyal) wrote:
> --- a/mercurial/debugcommands.py
> +++ b/mercurial/debugcommands.py
> @@ -1400,7 +1400,7 @@
>              try:
>                  st = vfs.lstat(name)
>                  age = now - st[stat.ST_MTIME]
> -                user = util.username(st.st_uid)
> +                user = pycompat.fsencode(util.username(st.st_uid))

This should be handled by posix/windows.username() just like the other
functions.
phabricator - May 31, 2018, 7:16 p.m.
durin42 added inline comments.

INLINE COMMENTS

> debugcommands.py:1403
>                  age = now - st[stat.ST_MTIME]
> -                user = util.username(st.st_uid)
> +                user = pycompat.fsencode(util.username(st.st_uid))
>                  locker = vfs.readlock(name)

Should util.username() instead consistently return bytes?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3636

To: pulkit, #hg-reviewers
Cc: durin42, mercurial-devel
phabricator - June 13, 2018, 9:42 a.m.
pulkit abandoned this revision.
pulkit added inline comments.

INLINE COMMENTS

> durin42 wrote in debugcommands.py:1403
> Should util.username() instead consistently return bytes?

Yes, https://phab.mercurial-scm.org/D3706 did that. Abandoning this one.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3636

To: pulkit, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1400,7 +1400,7 @@ 
             try:
                 st = vfs.lstat(name)
                 age = now - st[stat.ST_MTIME]
-                user = util.username(st.st_uid)
+                user = pycompat.fsencode(util.username(st.st_uid))
                 locker = vfs.readlock(name)
                 if ":" in locker:
                     host, pid = locker.split(':')