[PATCH] bookmarks: Change references to "repo" by references to "self"
Isaac Jurado
diptongo at gmail.com
Wed Jun 24 12:21:09 CDT 2009
# HG changeset patch
# User Isaac Jurado <diptongo at gmail.com>
# Date 1245864059 -7200
# Node ID dd8ea23c48e497c2326da044439cb3d88c90d03a
# Parent 288ba6d6c5c76716e827a69a80938885adf8c7ba
bookmarks: Change references to "repo" by references to "self"
Using "repo" instead of "self" inside bookmark_repo methods was causing a
circular reference and, thus, a memory leak. It has been detected because the
method bundlerepository.__del__ is never called, therefore leaving dangling
uncempressed bundles inside .hg subdirectory.
It fixes issue 1611.
diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -257,14 +257,14 @@
node = super(bookmark_repo, self).commit(*k, **kw)
if node is None:
return None
- parents = repo.changelog.parents(node)
+ parents = self.changelog.parents(node)
if parents[1] == nullid:
parents = (parents[0],)
- marks = parse(repo)
+ marks = parse(self)
update = False
for mark, n in marks.items():
if ui.configbool('bookmarks', 'track.current'):
- if mark == current(repo) and n in parents:
+ if mark == current(self) and n in parents:
marks[mark] = node
update = True
else:
@@ -272,28 +272,28 @@
marks[mark] = node
update = True
if update:
- write(repo, marks)
+ write(self, marks)
return node
finally:
wlock.release()
def addchangegroup(self, source, srctype, url, emptyok=False):
- parents = repo.dirstate.parents()
+ parents = self.dirstate.parents()
result = super(bookmark_repo, self).addchangegroup(
source, srctype, url, emptyok)
if result > 1:
# We have more heads than before
return result
- node = repo.changelog.tip()
- marks = parse(repo)
+ node = self.changelog.tip()
+ marks = parse(self)
update = False
for mark, n in marks.items():
if n in parents:
marks[mark] = node
update = True
if update:
- write(repo, marks)
+ write(self, marks)
return result
def tags(self):
@@ -302,7 +302,7 @@
return self.tagscache
tagscache = super(bookmark_repo, self).tags()
- tagscache.update(parse(repo))
+ tagscache.update(parse(self))
return tagscache
repo.__class__ = bookmark_repo
More information about the Mercurial-devel
mailing list