# HG changeset patch
# User Eric Hopper
# Date 1128990038 25200
# Node ID 26e73acc0cdfa537d882cdd55991e5e025631c49
# Parent 12a8d772fa3223d63b61d38b340536489dfaa2bc
Fix to handle case of empty list for roots or heads in nodesbetween.
diff -r 12a8d772fa32 -r 26e73acc0cdf mercurial/revlog.py
--- a/mercurial/revlog.py Mon Oct 10 08:36:29 2005 -0700
+++ b/mercurial/revlog.py Mon Oct 10 17:20:38 2005 -0700
@@ -261,8 +261,11 @@
If heads is unspecified, it is taken to be the output of the
heads method (i.e. a list of all nodes in the repository that
have no children)."""
+ nonodes = ([], [], [])
if roots is not None:
roots = list(roots)
+ if not roots:
+ return nonodes
lowestrev = min([self.rev(n) for n in roots])
else:
roots = [nullid] # Everybody's a descendent of nullid
@@ -280,9 +283,12 @@
# Set heads to an empty dictionary for later discovery of heads
heads = {}
else:
+ heads = list(heads)
+ if not heads:
+ return nonodes
ancestors = {}
# Start at the top and keep marking parents until we're done.
- nodestotag = list(heads)
+ nodestotag = heads[:]
# Turn heads into a dictionary so we can remove 'fake' heads.
# Also, later we will be using it to filter out the heads we can't
# find from roots.
@@ -311,7 +317,7 @@
# any other heads.
heads.pop(n)
if not ancestors:
- return ([], [], [])
+ return nonodes
# Now that we have our set of ancestors, we want to remove any
# roots that are not ancestors.
@@ -327,7 +333,7 @@
lowestrev = min([self.rev(n) for n in roots])
else:
# No more roots? Return empty list
- return ([], [], [])
+ return nonodes
else:
# We are descending from nullid, and don't need to care about
# any other roots.