Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 653:94cdd02792b5
Fix corruption resulting from skipping parts of a revision group
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Fix corruption resulting from skipping parts of a revision group
We were occassionally losing track of what revision a delta applied to
when we skipped over deltas we already had and applying the delta
against the wrong base. This could result in coredumps from mpatch,
consistency errors, or failed verify.
manifest hash: fcf20a8abfd81f08fae2398136b2ed66216b2083
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCzu5SywK+sNU5EO8RAi10AJ9cqIfQzOzbcdH36t1LR/rY+UMtHwCeM79p
Dtv+Jh0McLZr6nf4iJyhDgI=
=5o6U
-----END PGP SIGNATURE-----
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 08 Jul 2005 13:21:22 -0800 |
parents | 08b65d66f3e7 |
children | b3bba126b04a |
comparison
equal
deleted
inserted
replaced
652:a54a1c101a9a | 653:94cdd02792b5 |
---|---|
473 # track the base of the current delta log | 473 # track the base of the current delta log |
474 r = self.count() | 474 r = self.count() |
475 t = r - 1 | 475 t = r - 1 |
476 node = nullid | 476 node = nullid |
477 | 477 |
478 base = prev = -1 | 478 base = -1 |
479 start = end = 0 | 479 start = end = measure = 0 |
480 if r: | 480 if r: |
481 start = self.start(self.base(t)) | 481 start = self.start(self.base(t)) |
482 end = self.end(t) | 482 end = self.end(t) |
483 measure = self.length(self.base(t)) | 483 measure = self.length(self.base(t)) |
484 base = self.base(t) | 484 base = self.base(t) |
489 dfh = self.opener(self.datafile, "a") | 489 dfh = self.opener(self.datafile, "a") |
490 ifh = self.opener(self.indexfile, "a") | 490 ifh = self.opener(self.indexfile, "a") |
491 | 491 |
492 # loop through our set of deltas | 492 # loop through our set of deltas |
493 chain = None | 493 chain = None |
494 prev = self.tip() | |
494 for chunk in revs: | 495 for chunk in revs: |
495 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80]) | 496 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80]) |
496 link = linkmapper(cs) | 497 link = linkmapper(cs) |
497 if node in self.nodemap: | 498 if node in self.nodemap: |
498 # this can happen if two branches make the same change | 499 # this can happen if two branches make the same change |
499 if unique: | 500 if unique: |
500 raise "already have %s" % hex(node[:4]) | 501 raise "already have %s" % hex(node[:4]) |
502 chain = node | |
501 continue | 503 continue |
502 delta = chunk[80:] | 504 delta = chunk[80:] |
503 | 505 |
504 if not chain: | 506 if not chain: |
505 # retrieve the parent revision of the delta chain | 507 # retrieve the parent revision of the delta chain |