# HG changeset patch # User Matt Harbison # Date 1733422544 18000 # Node ID 4c70a70a9bcd6019f7c6310b476ec57d585e637d # Parent 6baf4c6ee14b8d0d7565d96b299cade8b508b801 convert: stop using the `pycompat.open()` shim diff -r 6baf4c6ee14b -r 4c70a70a9bcd hgext/convert/convcmd.py --- 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( diff -r 6baf4c6ee14b -r 4c70a70a9bcd hgext/convert/cvsps.py --- 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 diff -r 6baf4c6ee14b -r 4c70a70a9bcd hgext/convert/hg.py --- 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() diff -r 6baf4c6ee14b -r 4c70a70a9bcd hgext/convert/monotone.py --- 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'' diff -r 6baf4c6ee14b -r 4c70a70a9bcd hgext/convert/subversion.py --- 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)))