Commits

Anonymous committed 911cdf2

- Fix recursion problem in colateChildren when more than 1000 changesets are attempted to
be transferred at any one time.

Comments (0)

Files changed (1)

exclude-changesets.py

 #!/usr/bin/env python
 
-'''exclude-changesets is a Mercurial extension which sets up a pretxncommit hook.
+'''exclude_changesets is a Mercurial extension which sets up a pretxncommit hook.
 Any changesets to be pushed / pulled / bundled into the repository will have their
 changeset hashes compared against a list of excluded hashes in repo/.excludedchangesets.
 If any new hash is already in this file of excluded hashes then the entire
 changegroup will be rejected.
 
-Enable the exclude-changesets just like any other Mercurial extension by adding the
+Enable the exclude_changesets just like any other Mercurial extension by adding the
 following to your hgrc
 
 [extensions]
-exclude-changesets = /path/to/exclude-changesets
+exclude_changesets = /path/to/exclude_changesets
 '''
 
 import os.path, re
     return False
 
 def colateChildren(ctx, colation = set()):
-    children = ctx.children()
-    colation.add(ctx.hex())
-    for childCtx in children:
-        if not childCtx.hex() in colation:
-            colateChildren(childCtx, colation)
+    testSet = set()
+    testSet.add(ctx)
+    while len(testSet) > 0:
+        revCtx = testSet.pop()
+        revCtxHex = revCtx.hex()
+        if not revCtxHex in colation:
+            colation.add(revCtxHex)
+            testSet.update(revCtx.children())            
     return colation
 
 def checkForExcludedChangesets(ui, repo, **kwargs):
     return False # No excluded changesets were found. The changegroup addition can go ahead.
 
 def reposetup(ui, repo):
-    ui.setconfig("hooks", "pretxnchangegroup.exclude-changesets", checkForExcludedChangesets)
+    ui.setconfig("hooks", "pretxnchangegroup.exclude_changesets", checkForExcludedChangesets)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.