Mercurial > public > mercurial-scm > hg-stable
changeset 52424:4c70a70a9bcd
convert: stop using the `pycompat.open()` shim
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 05 Dec 2024 13:15:44 -0500 |
parents | 6baf4c6ee14b |
children | 10f98d358f6c |
files | hgext/convert/convcmd.py hgext/convert/cvsps.py hgext/convert/hg.py hgext/convert/monotone.py hgext/convert/subversion.py |
diffstat | 5 files changed, 9 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/convcmd.py Thu Dec 05 13:11:41 2024 -0500 +++ b/hgext/convert/convcmd.py Thu Dec 05 13:15:44 2024 -0500 @@ -23,7 +23,6 @@ ) from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial import ( encoding, error, @@ -76,7 +75,7 @@ def readauthormap(ui: "uimod.ui", authorfile, authors=None): if authors is None: authors = {} - with open(authorfile, b'rb') as afile: + with open(authorfile, 'rb') as afile: for line in afile: line = line.strip() if not line or line.startswith(b'#'): @@ -314,7 +313,7 @@ return {} m = {} try: - with open(path, b'rb') as fp: + with open(path, 'rb') as fp: for i, line in enumerate(fp): line = line.splitlines()[0].rstrip() if not line: @@ -511,7 +510,7 @@ authorfile = self.authorfile if authorfile: self.ui.status(_(b'writing author map file %s\n') % authorfile) - with open(authorfile, b'wb+') as ofile: + with open(authorfile, 'wb+') as ofile: for author in self.authors: ofile.write( util.tonativeeol(
--- a/hgext/convert/cvsps.py Thu Dec 05 13:11:41 2024 -0500 +++ b/hgext/convert/cvsps.py Thu Dec 05 13:15:44 2024 -0500 @@ -13,7 +13,6 @@ import re from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial import ( encoding, error, @@ -150,7 +149,7 @@ # Get the real directory in the repository try: - with open(os.path.join(b'CVS', b'Repository'), b'rb') as f: + with open(os.path.join(b'CVS', b'Repository'), 'rb') as f: prefix = f.read().strip() directory = prefix if prefix == b".": @@ -197,7 +196,7 @@ if cache == b'update': try: ui.note(_(b'reading cvs log cache %s\n') % cachefile) - with open(cachefile, b'rb') as fp: + with open(cachefile, 'rb') as fp: oldlog = pickle.load(fp) for e in oldlog: if not ( @@ -530,7 +529,7 @@ # write the new cachefile ui.note(_(b'writing cvs log cache %s\n') % cachefile) - with open(cachefile, b'wb') as fp: + with open(cachefile, 'wb') as fp: pickle.dump(log, fp) else: log = oldlog
--- a/hgext/convert/hg.py Thu Dec 05 13:11:41 2024 -0500 +++ b/hgext/convert/hg.py Thu Dec 05 13:15:44 2024 -0500 @@ -24,7 +24,6 @@ import time from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial.node import ( bin, hex, @@ -707,7 +706,7 @@ def converted(self, rev, destrev): if self.convertfp is None: - self.convertfp = open(self.repo.vfs.join(b'shamap'), b'ab') + self.convertfp = open(self.repo.vfs.join(b'shamap'), 'ab') self.convertfp.write(util.tonativeeol(b'%s %s\n' % (destrev, rev))) self.convertfp.flush()
--- a/hgext/convert/monotone.py Thu Dec 05 13:11:41 2024 -0500 +++ b/hgext/convert/monotone.py Thu Dec 05 13:15:44 2024 -0500 @@ -15,7 +15,6 @@ ) from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial import ( error, pycompat, @@ -48,7 +47,7 @@ if not os.path.exists(os.path.join(path, b'_MTN')): # Could be a monotone repository (SQLite db file) try: - with open(path, b'rb') as f: + with open(path, 'rb') as f: header = f.read(16) except IOError: header = b''
--- a/hgext/convert/subversion.py Thu Dec 05 13:11:41 2024 -0500 +++ b/hgext/convert/subversion.py Thu Dec 05 13:15:44 2024 -0500 @@ -12,7 +12,6 @@ import xml.dom.minidom from mercurial.i18n import _ -from mercurial.pycompat import open from mercurial import ( encoding, error, @@ -895,7 +894,7 @@ return if self.convertfp is None: self.convertfp = open( - os.path.join(self.wc, b'.svn', b'hg-shamap'), b'ab' + os.path.join(self.wc, b'.svn', b'hg-shamap'), 'ab' ) self.convertfp.write( util.tonativeeol(b'%s %d\n' % (destrev, self.revnum(rev)))