##// END OF EJS Templates
Fix to handle case of empty list for roots or heads in nodesbetween.
Eric Hopper -
r1463:26e73acc default
parent child Browse files
Show More
@@ -261,8 +261,11 b' class revlog:'
261 If heads is unspecified, it is taken to be the output of the
261 If heads is unspecified, it is taken to be the output of the
262 heads method (i.e. a list of all nodes in the repository that
262 heads method (i.e. a list of all nodes in the repository that
263 have no children)."""
263 have no children)."""
264 nonodes = ([], [], [])
264 if roots is not None:
265 if roots is not None:
265 roots = list(roots)
266 roots = list(roots)
267 if not roots:
268 return nonodes
266 lowestrev = min([self.rev(n) for n in roots])
269 lowestrev = min([self.rev(n) for n in roots])
267 else:
270 else:
268 roots = [nullid] # Everybody's a descendent of nullid
271 roots = [nullid] # Everybody's a descendent of nullid
@@ -280,9 +283,12 b' class revlog:'
280 # Set heads to an empty dictionary for later discovery of heads
283 # Set heads to an empty dictionary for later discovery of heads
281 heads = {}
284 heads = {}
282 else:
285 else:
286 heads = list(heads)
287 if not heads:
288 return nonodes
283 ancestors = {}
289 ancestors = {}
284 # Start at the top and keep marking parents until we're done.
290 # Start at the top and keep marking parents until we're done.
285 nodestotag = list(heads)
291 nodestotag = heads[:]
286 # Turn heads into a dictionary so we can remove 'fake' heads.
292 # Turn heads into a dictionary so we can remove 'fake' heads.
287 # Also, later we will be using it to filter out the heads we can't
293 # Also, later we will be using it to filter out the heads we can't
288 # find from roots.
294 # find from roots.
@@ -311,7 +317,7 b' class revlog:'
311 # any other heads.
317 # any other heads.
312 heads.pop(n)
318 heads.pop(n)
313 if not ancestors:
319 if not ancestors:
314 return ([], [], [])
320 return nonodes
315 # Now that we have our set of ancestors, we want to remove any
321 # Now that we have our set of ancestors, we want to remove any
316 # roots that are not ancestors.
322 # roots that are not ancestors.
317
323
@@ -327,7 +333,7 b' class revlog:'
327 lowestrev = min([self.rev(n) for n in roots])
333 lowestrev = min([self.rev(n) for n in roots])
328 else:
334 else:
329 # No more roots? Return empty list
335 # No more roots? Return empty list
330 return ([], [], [])
336 return nonodes
331 else:
337 else:
332 # We are descending from nullid, and don't need to care about
338 # We are descending from nullid, and don't need to care about
333 # any other roots.
339 # any other roots.
General Comments 0
You need to be logged in to leave comments. Login now