Skip to content
This repository
Browse code

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>
  • Loading branch information...
commit f9d36ebf48a79da0d5fb18c2eb1eeca0cd4f6a80 1 parent e76a3d2
dscho dscho authored

Showing 2 changed files with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +3 3 git-remote-hg.py
  2. +1 1  git_remote_helpers/git/repo.py
6 git-remote-hg.py
@@ -42,7 +42,7 @@ def get_repo(self, alias, url):
42 42 repo.marksfile = 'git.marks'
43 43 repo.hg = hg
44 44 repo.prefix = prefix
45   - repo.revs = revs
  45 + repo.revs2 = revs # must not override repo.revs()
46 46
47 47 self.setup_repo(repo, alias)
48 48
@@ -65,7 +65,7 @@ def local_repo(self, repo, path):
65 65
66 66 local.git_hg = repo.git_hg
67 67 local.hg = repo.hg
68   - local.revs = repo.revs
  68 + local.revs2 = repo.revs2
69 69 local.exporter = GitExporter(local)
70 70 local.importer = GitImporter(local)
71 71 local.is_local = repo.is_local
@@ -76,7 +76,7 @@ def do_list(self, repo, args):
76 76 """Lists all known references.
77 77 """
78 78
79   - for ref in repo.revs:
  79 + for ref in repo.revs2:
80 80 debug("? refs/heads/%s", ref)
81 81 print "? refs/heads/%s" % ref
82 82
2  git_remote_helpers/git/repo.py
@@ -61,7 +61,7 @@ def get_revs(self):
61 61 self.revmap = dict(sanitize(i) for i in output)
62 62 if "HEAD" in self.revmap:
63 63 del self.revmap["HEAD"]
64   - self.revs = self.revmap.keys()
  64 + self.revs2 = self.revmap.keys()
65 65 ofile.close()
66 66
67 67 def get_head(self):

0 comments on commit f9d36eb

Please sign in to comment.
Something went wrong with that request. Please try again.