Mercurial > hg-stable
changeset 1463:26e73acc0cdf
Fix to handle case of empty list for roots or heads in nodesbetween.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Mon, 10 Oct 2005 17:20:38 -0700 |
parents | 12a8d772fa32 |
children | 00117edce2dd |
files | mercurial/revlog.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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.