Mercurial > hg
changeset 39615:a658f97c1ce4
censor: use a reasonable amount of memory
Before this change, trying to censor some random revision uses an ever
increasing amount of memory (I stopped at 20GB, but it was by no means
finished), presumably because these contexts have a lot of
information that is kept alive.
After this change, the memory usage plateaus quickly.
Differential Revision: https://phab.mercurial-scm.org/D4582
author | Valentin Gatien-Baron <vgatien-baron@janestreet.com> |
---|---|
date | Thu, 13 Sep 2018 16:22:53 -0400 |
parents | a2880ac67ee0 |
children | 5a2bf7f941fa |
files | hgext/censor.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/censor.py Fri Sep 14 22:25:44 2018 +0900 +++ b/hgext/censor.py Thu Sep 13 16:22:53 2018 -0400 @@ -83,8 +83,11 @@ raise error.Abort(_('file does not exist at revision %s') % rev) fnode = fctx.filenode() - headctxs = [repo[c] for c in repo.heads()] - heads = [c for c in headctxs if path in c and c.filenode(path) == fnode] + heads = [] + for headnode in repo.heads(): + c = repo[headnode] + if path in c and c.filenode(path) == fnode: + heads.append(c) if heads: headlist = ', '.join([short(c.node()) for c in heads]) raise error.Abort(_('cannot censor file in heads (%s)') % headlist,