D2158: py3: use raw string for open() mode
This revision now requires changes to proceed. baymax added a comment. baymax requested changes to this revision. There seems to have been no activities on this Diff for the past 3 Months. By policy, we are automatically moving it out of the `need-review` state. Please, move it back to `need-review` without hesitation if this diff should still be discussed. :baymax:need-review-idle: REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D2158/new/ REVISION DETAIL https://phab.mercurial-scm.org/D2158 To: indygreg, #hg-reviewers, baymax Cc: yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2158: py3: use raw string for open() mode
yuja added a comment. I wanna leave it with no prefix as possible. I think we'll have to bulk-replace `''`s to `b''`s at some point so we can leverage static analysis tools, where `r''` will be unneeded. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2158 To: indygreg, #hg-reviewers Cc: yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2158: py3: use raw string for open() mode
pulkit added a comment. Looks like a better approach will be to revert this change: https://www.mercurial-scm.org/repo/hg/rev/7c54917b31f6. I did that in favor of pycompat.open() and now I think it's better to revert that change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2158 To: indygreg, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2158: py3: use raw string for open() mode
indygreg 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/D2158 AFFECTED FILES hgext/largefiles/lfutil.py CHANGE DETAILS diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -57,7 +57,7 @@ util.oslink(src, dest) except OSError: # if hardlinks fail, fallback on atomic copy -with open(src, 'rb') as srcf, util.atomictempfile(dest) as dstf: +with open(src, r'rb') as srcf, util.atomictempfile(dest) as dstf: for chunk in util.filechunkiter(srcf): dstf.write(chunk) os.chmod(dest, os.stat(src).st_mode) @@ -236,7 +236,7 @@ wvfs.makedirs(wvfs.dirname(wvfs.join(filename))) # The write may fail before the file is fully written, but we # don't use atomic writes in the working copy. -with open(path, 'rb') as srcfd, wvfs(filename, 'wb') as destfd: +with open(path, r'rb') as srcfd, wvfs(filename, 'wb') as destfd: gothash = copyandhash( util.filechunkiter(srcfd), destfd) if gothash != hash: @@ -271,7 +271,7 @@ link(usercachepath(repo.ui, hash), storepath(repo, hash)) else: util.makedirs(os.path.dirname(storepath(repo, hash))) -with open(file, 'rb') as srcf: +with open(file, r'rb') as srcf: with util.atomictempfile(storepath(repo, hash), createmode=repo.store.createmode) as dstf: for chunk in util.filechunkiter(srcf): @@ -376,7 +376,7 @@ def hashfile(file): if not os.path.exists(file): return '' -with open(file, 'rb') as fd: +with open(file, r'rb') as fd: return hexsha1(fd) def getexecutable(filename): To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel