remote-hg: do not interfer with hg's revs() method

Matt Mackall introduced a revs() method to the localrepo class on Wed
Nov 2 13:37:34 2011 in the commit 'localrepo: add revs helper method'.
It is used when constructing a commit in memory.

If we store the set of revs we want to handle under the same name, it
overrides that method, resulting in an unpleasant 'TypeError: 'set'
object is not callable' whenever we want to push (as we are constructing
commits in memory, then).

So let's work around that by renaming our field to 'revs_' and hope that
upstream Mercurial does not introduce a field of that name, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2012-04-07 02:12:53 -05:00
committed by Pat Thoyts
parent 55e0e4ec37
commit 30f7bd7702
3 changed files with 5 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ class HgRemoteHelper(RemoteHelper):
repo.marksfile = 'git.marks'
repo.hg = hg
repo.prefix = prefix
repo.revs = revs
repo.revs_ = revs # must not override repo.revs()
self.setup_repo(repo, alias)
@@ -65,7 +65,7 @@ class HgRemoteHelper(RemoteHelper):
local.git_hg = repo.git_hg
local.hg = repo.hg
local.revs = repo.revs
local.revs_ = repo.revs_
local.exporter = GitExporter(local)
local.importer = GitImporter(local)
local.is_local = repo.is_local
@@ -76,7 +76,7 @@ class HgRemoteHelper(RemoteHelper):
"""Lists all known references.
"""
for ref in repo.revs:
for ref in repo.revs_:
debug("? refs/heads/%s", ref)
print "? refs/heads/%s" % ref

View File

@@ -56,7 +56,7 @@ class TestgitRemoteHelper(RemoteHelper):
head is at clone time.
"""
for ref in repo.revs:
for ref in repo.revs_:
debug("? refs/heads/%s", ref)
print "? refs/heads/%s" % ref

View File

@@ -61,7 +61,7 @@ class GitRepo(object):
self.revmap = dict(sanitize(i) for i in output)
if "HEAD" in self.revmap:
del self.revmap["HEAD"]
self.revs = self.revmap.keys()
self.revs_ = self.revmap.keys()
ofile.close()
def get_head(self):