comparison mercurial/revlog.py @ 381:024ee0f8722a

Ancestor algorithm fix -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ancestor algorithm fix The ancestor algorithm was a bit too optimistic about node ordering still. Add revision numbers to the comparison to sort things out. manifest hash: f4eaf95057b5623e864359706dcaee820b10fd20 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCsTrCywK+sNU5EO8RAtqMAJ9fEJEesPn+0SMg/i/g5vZYmX/pBgCfVnhl +s88q/Wilw27MVWP6J6oqX8= =k9AU -----END PGP SIGNATURE-----
author mpm@selenic.com
date Thu, 16 Jun 2005 00:39:30 -0800
parents e5d769afd3ef
children c9d134165392
comparison
equal deleted inserted replaced
380:c72ccad3e3b8 381:024ee0f8722a
323 h = [(-dist[node], node)] 323 h = [(-dist[node], node)]
324 seen = {} 324 seen = {}
325 earliest = self.count() 325 earliest = self.count()
326 while h: 326 while h:
327 d, n = heapq.heappop(h) 327 d, n = heapq.heappop(h)
328 r = self.rev(n)
329 if n not in seen: 328 if n not in seen:
330 seen[n] = 1 329 seen[n] = 1
331 yield (-d, n) 330 r = self.rev(n)
331 yield (-d, r, n)
332 for p in self.parents(n): 332 for p in self.parents(n):
333 heapq.heappush(h, (-dist[p], p)) 333 heapq.heappush(h, (-dist[p], p))
334 334
335 x = ancestors(a) 335 x = ancestors(a)
336 y = ancestors(b) 336 y = ancestors(b)
339 339
340 # increment each ancestor list until it is closer to root than 340 # increment each ancestor list until it is closer to root than
341 # the other, or they match 341 # the other, or they match
342 while 1: 342 while 1:
343 if lx == ly: 343 if lx == ly:
344 return lx[1] 344 return lx[2]
345 elif lx < ly: 345 elif lx < ly:
346 ly = y.next() 346 ly = y.next()
347 elif lx > ly: 347 elif lx > ly:
348 lx = x.next() 348 lx = x.next()
349 349