comparison mercurial/revlog.py @ 224:ccbcc4d76f81

fix bad assumption about uniqueness of file versions -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 fix bad assumption about uniqueness of file versions Mercurial had assumed that a given file hash could show up in only one changeset, and thus that the mapping from file revision to changeset was 1-to-1. But if two people perform the same edit with the same parents, we can get an identical hash in different changesets. So we've got to loosen up our uniqueness checks in addgroup and in verify. manifest hash: 5462003241e7d071ffa1741b87a59f646c9988ed -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoMDkywK+sNU5EO8RAg9PAJ9YWSknfFBoeYve/+Z5DDGGvytDkwCgoMwj kT01PcjNzGPr1/Oe5WRvulE= =HC4t -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 03 Jun 2005 12:43:16 -0800
parents 2bfe525ef6ca
children 4f802588cdfb 4f802588cdfb afe895fcc0d0
comparison
equal deleted inserted replaced
223:1aaa49039a6b 224:ccbcc4d76f81
431 yield meta 431 yield meta
432 yield d 432 yield d
433 433
434 yield struct.pack(">l", 0) 434 yield struct.pack(">l", 0)
435 435
436 def addgroup(self, revs, linkmapper, transaction): 436 def addgroup(self, revs, linkmapper, transaction, unique = 0):
437 # given a set of deltas, add them to the revision log. the 437 # given a set of deltas, add them to the revision log. the
438 # first delta is against its parent, which should be in our 438 # first delta is against its parent, which should be in our
439 # log, the rest are against the previous delta. 439 # log, the rest are against the previous delta.
440 440
441 # track the base of the current delta log 441 # track the base of the current delta log
461 chain = None 461 chain = None
462 for chunk in revs: 462 for chunk in revs:
463 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80]) 463 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
464 link = linkmapper(cs) 464 link = linkmapper(cs)
465 if node in self.nodemap: 465 if node in self.nodemap:
466 raise "already have %s" % hex(node[:4]) 466 # this can happen if two branches make the same change
467 if unique:
468 raise "already have %s" % hex(node[:4])
469 continue
467 delta = chunk[80:] 470 delta = chunk[80:]
468 471
469 if not chain: 472 if not chain:
470 # retrieve the parent revision of the delta chain 473 # retrieve the parent revision of the delta chain
471 chain = p1 474 chain = p1