D4582: censor: use a reasonable amount of memory

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Thu Sep 13 19:13:18 EDT 2018


valentin.gatienbaron updated this revision to Diff 11039.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4582?vs=11021&id=11039

REVISION DETAIL
  https://phab.mercurial-scm.org/D4582

AFFECTED FILES
  hgext/censor.py

CHANGE DETAILS

diff --git a/hgext/censor.py b/hgext/censor.py
--- a/hgext/censor.py
+++ b/hgext/censor.py
@@ -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,



To: valentin.gatienbaron, #hg-reviewers
Cc: durin42, indygreg, mercurial-devel


More information about the Mercurial-devel mailing list