[PATCH 03 of 10] change all opener(...).read() calls to opener.read(...)
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Wed Dec 1 15:34:56 CST 2010
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1291227968 -3600
# Node ID 86fb0a3d66d582da4a3643963b15a5dba9146a14
# Parent 8c47f61bd78b2bdcbd088e0b2fed3bedc4e995eb
change all opener(...).read() calls to opener.read(...)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -272,14 +272,14 @@ class queue(object):
def parse(l):
n, name = l.split(':', 1)
return statusentry(bin(n), name)
- lines = self.opener(self.status_path).read().splitlines()
+ lines = self.opener.read(self.status_path).splitlines()
return [parse(l) for l in lines]
return []
@util.propertycache
def full_series(self):
if os.path.exists(self.join(self.series_path)):
- return self.opener(self.series_path).read().splitlines()
+ return self.opener.read(self.series_path).splitlines()
return []
@util.propertycache
@@ -393,7 +393,7 @@ class queue(object):
if self.active_guards is None:
self.active_guards = []
try:
- guards = self.opener(self.guards_path).read().split()
+ guards = self.opener.read(self.guards_path).split()
except IOError, err:
if err.errno != errno.ENOENT:
raise
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -39,7 +39,7 @@ class transplants(object):
def read(self):
abspath = os.path.join(self.path, self.transplantfile)
if self.transplantfile and os.path.exists(abspath):
- for line in self.opener(self.transplantfile).read().splitlines():
+ for line in self.opener.read(self.transplantfile).splitlines():
lnode, rnode = map(revlog.bin, line.split(':'))
list = self.transplants.setdefault(rnode, [])
list.append(transplantentry(lnode, rnode))
@@ -317,7 +317,7 @@ class transplanter(object):
nodes = []
merges = []
cur = nodes
- for line in self.opener('series').read().splitlines():
+ for line in self.opener.read('series').splitlines():
if line.startswith('# Merges'):
cur = merges
continue
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -73,7 +73,7 @@ class dirstate(object):
@propertycache
def _branch(self):
try:
- return self._opener("branch").read().strip() or "default"
+ return self._opener.read("branch").strip() or "default"
except IOError:
return "default"
@@ -217,7 +217,7 @@ class dirstate(object):
self._map = {}
self._copymap = {}
try:
- st = self._opener("dirstate").read()
+ st = self._opener.read("dirstate")
except IOError, err:
if err.errno != errno.ENOENT:
raise
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -147,7 +147,7 @@ def share(ui, source, dest=None, update=
requirements = ''
try:
- requirements = srcrepo.opener('requires').read()
+ requirements = srcrepo.opener.read('requires')
except IOError, inst:
if inst.errno != errno.ENOENT:
raise
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -70,7 +70,7 @@ class localrepository(repo.repository):
# find requirements
requirements = set()
try:
- requirements = set(self.opener("requires").read().splitlines())
+ requirements = set(self.opener.read("requires").splitlines())
except IOError, inst:
if inst.errno != errno.ENOENT:
raise
@@ -79,7 +79,7 @@ class localrepository(repo.repository):
self.sharedpath = self.path
try:
- s = os.path.realpath(self.opener("sharedpath").read())
+ s = os.path.realpath(self.opener.read("sharedpath"))
if not os.path.exists(s):
raise error.RepoError(
_('.hg/sharedpath points to nonexistent directory %s') % s)
@@ -624,7 +624,7 @@ class localrepository(repo.repository):
if self._link(filename):
data = os.readlink(self.wjoin(filename))
else:
- data = self.wopener(filename, 'r').read()
+ data = self.wopener.read(filename, 'r')
return self._filter(self._encodefilterpats, filename, data)
def wwrite(self, filename, data, flags):
@@ -655,7 +655,7 @@ class localrepository(repo.repository):
# save dirstate for rollback
try:
- ds = self.opener("dirstate").read()
+ ds = self.opener.read("dirstate")
except IOError:
ds = ""
self.opener("journal.dirstate", "w").write(ds)
@@ -696,7 +696,7 @@ class localrepository(repo.repository):
lock = self.lock()
if os.path.exists(self.sjoin("undo")):
try:
- args = self.opener("undo.desc", "r").read().splitlines()
+ args = self.opener.read("undo.desc", "r").splitlines()
if len(args) >= 3 and self.ui.verbose:
desc = _("rolling back to revision %s"
" (undo %s: %s)\n") % (
@@ -713,7 +713,7 @@ class localrepository(repo.repository):
self.ui.warn)
util.rename(self.join("undo.dirstate"), self.join("dirstate"))
try:
- branch = self.opener("undo.branch").read()
+ branch = self.opener.read("undo.branch")
self.dirstate.setbranch(branch)
except IOError:
self.ui.warn(_("Named branch could not be reset, "
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -94,7 +94,7 @@ class statichttprepository(localrepo.loc
# find requirements
try:
- requirements = self.opener("requires").read().splitlines()
+ requirements = self.opener.read("requires").splitlines()
except IOError, inst:
if inst.errno != errno.ENOENT:
raise
diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -61,7 +61,7 @@ def readlocaltags(ui, repo, alltags, tag
try:
# localtags is in the local encoding; re-encode to UTF-8 on
# input for consistency with the rest of this module.
- data = repo.opener("localtags").read()
+ data = repo.opener.read("localtags")
filetags = _readtags(
ui, repo, data.splitlines(), "localtags",
recode=encoding.fromlocal)
More information about the Mercurial-devel
mailing list