D5073: archival: don't try and fsdecode non-{bytes,str} objects
This revision was automatically updated to reflect the committed changes. Closed by commit rHG844deb408a5b: archival: dont try and fsdecode non-{bytes,str} objects (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5073?vs=12050=12056 REVISION DETAIL https://phab.mercurial-scm.org/D5073 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -203,7 +203,9 @@ or compressed with deflate.''' def __init__(self, dest, mtime, compress=True): -self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w', +if isinstance(dest, bytes): +dest = pycompat.fsdecode(dest) +self.z = zipfile.ZipFile(dest, r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5073: archival: don't try and fsdecode non-{bytes,str} objects
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This function accepts both bytes and file-like objects. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5073 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -203,7 +203,9 @@ or compressed with deflate.''' def __init__(self, dest, mtime, compress=True): -self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w', +if isinstance(dest, bytes): +dest = pycompat.fsdecode(dest) +self.z = zipfile.ZipFile(dest, r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel