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 'revs2' 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
parent e76a3d289b
commit f9d36ebf48
2 changed files with 4 additions and 4 deletions

View File

@@ -42,7 +42,7 @@ class HgRemoteHelper(RemoteHelper):
repo.marksfile = 'git.marks'
repo.hg = hg
repo.prefix = prefix
repo.revs = revs
repo.revs2 = 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.revs2 = repo.revs2
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.revs2:
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.revs2 = self.revmap.keys()
ofile.close()
def get_head(self):