D2333: py3: make sure we open the files in bytes mode

2018-02-19 Thread yuja (Yuya Nishihara)
yuja added inline comments.

INLINE COMMENTS

> posix.py:116
>  # switch file to link
> -fp = open(f)
> +fp = open(f, 'wb')
>  data = fp.read()

should be 'rb'

Fixed in flight.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja, indygreg
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2333: py3: make sure we open the files in bytes mode

2018-02-18 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7e025d4c6f61: py3: make sure we open the files in bytes 
mode (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2333?vs=5879&id=5888

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

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -113,24 +113,24 @@
 if l:
 if not stat.S_ISLNK(s):
 # switch file to link
-fp = open(f)
+fp = open(f, 'wb')
 data = fp.read()
 fp.close()
 unlink(f)
 try:
 os.symlink(data, f)
 except OSError:
 # failed to make a link, rewrite file
-fp = open(f, "w")
+fp = open(f, "wb")
 fp.write(data)
 fp.close()
 # no chmod needed at this point
 return
 if stat.S_ISLNK(s):
 # switch link to file
 data = os.readlink(f)
 unlink(f)
-fp = open(f, "w")
+fp = open(f, "wb")
 fp.write(data)
 fp.close()
 s = 0o666 & ~umask # avoid restatting for chmod



To: pulkit, #hg-reviewers, yuja, indygreg
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2333: py3: make sure we open the files in bytes mode

2018-02-18 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 5879.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2333?vs=5862&id=5879

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

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -113,24 +113,24 @@
 if l:
 if not stat.S_ISLNK(s):
 # switch file to link
-fp = open(f)
+fp = open(f, 'wb')
 data = fp.read()
 fp.close()
 unlink(f)
 try:
 os.symlink(data, f)
 except OSError:
 # failed to make a link, rewrite file
-fp = open(f, "w")
+fp = open(f, "wb")
 fp.write(data)
 fp.close()
 # no chmod needed at this point
 return
 if stat.S_ISLNK(s):
 # switch link to file
 data = os.readlink(f)
 unlink(f)
-fp = open(f, "w")
+fp = open(f, "wb")
 fp.write(data)
 fp.close()
 s = 0o666 & ~umask # avoid restatting for chmod



To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2333: py3: make sure we open the files in bytes mode

2018-02-18 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> posix.py:116
>  # switch file to link
>  fp = open(f)
>  data = fp.read()

Two more missing 'b's, here

> posix.py:124
>  # failed to make a link, rewrite file
>  fp = open(f, "w")
>  fp.write(data)

and here.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2333: py3: make sure we open the files in bytes mode

2018-02-18 Thread pulkit (Pulkit Goyal)
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/D2333

AFFECTED FILES
  mercurial/posix.py

CHANGE DETAILS

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -130,7 +130,7 @@
 # switch link to file
 data = os.readlink(f)
 unlink(f)
-fp = open(f, "w")
+fp = open(f, "wb")
 fp.write(data)
 fp.close()
 s = 0o666 & ~umask # avoid restatting for chmod



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel