comparison mercurial/revlog.py @ 1402:9d2c2e6b32b5

i18n part2: use '_' for all strings who are part of the user interface
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 18 Oct 2005 18:38:39 -0700
parents cf9a1233738a
children bc3e66edb04c
comparison
equal deleted inserted replaced
1401:fbf2b10011aa 1402:9d2c2e6b32b5
46 if not bin: return bin 46 if not bin: return bin
47 t = bin[0] 47 t = bin[0]
48 if t == '\0': return bin 48 if t == '\0': return bin
49 if t == 'x': return zlib.decompress(bin) 49 if t == 'x': return zlib.decompress(bin)
50 if t == 'u': return bin[1:] 50 if t == 'u': return bin[1:]
51 raise RevlogError("unknown compression type %s" % t) 51 raise RevlogError(_("unknown compression type %s") % t)
52 52
53 indexformat = ">4l20s20s20s" 53 indexformat = ">4l20s20s20s"
54 54
55 class lazyparser: 55 class lazyparser:
56 """ 56 """
212 def node(self, rev): return (rev < 0) and nullid or self.index[rev][6] 212 def node(self, rev): return (rev < 0) and nullid or self.index[rev][6]
213 def rev(self, node): 213 def rev(self, node):
214 try: 214 try:
215 return self.nodemap[node] 215 return self.nodemap[node]
216 except KeyError: 216 except KeyError:
217 raise RevlogError('%s: no node %s' % (self.indexfile, hex(node))) 217 raise RevlogError(_('%s: no node %s') % (self.indexfile, hex(node)))
218 def linkrev(self, node): return self.index[self.rev(node)][3] 218 def linkrev(self, node): return self.index[self.rev(node)][3]
219 def parents(self, node): 219 def parents(self, node):
220 if node == nullid: return (nullid, nullid) 220 if node == nullid: return (nullid, nullid)
221 return self.index[self.rev(node)][4:6] 221 return self.index[self.rev(node)][4:6]
222 222
292 except (ValueError, OverflowError): 292 except (ValueError, OverflowError):
293 c = [] 293 c = []
294 for n in self.nodemap: 294 for n in self.nodemap:
295 if hex(n).startswith(id): 295 if hex(n).startswith(id):
296 c.append(n) 296 c.append(n)
297 if len(c) > 1: raise RevlogError("Ambiguous identifier") 297 if len(c) > 1: raise RevlogError(_("Ambiguous identifier"))
298 if len(c) < 1: raise RevlogError("No match found") 298 if len(c) < 1: raise RevlogError(_("No match found"))
299 return c[0] 299 return c[0]
300 300
301 return None 301 return None
302 302
303 def diff(self, a, b): 303 def diff(self, a, b):
355 last = last + s 355 last = last + s
356 356
357 text = mdiff.patches(text, bins) 357 text = mdiff.patches(text, bins)
358 358
359 if node != hash(text, p1, p2): 359 if node != hash(text, p1, p2):
360 raise RevlogError("integrity check failed on %s:%d" 360 raise RevlogError(_("integrity check failed on %s:%d")
361 % (self.datafile, rev)) 361 % (self.datafile, rev))
362 362
363 self.cache = (node, rev, text) 363 self.cache = (node, rev, text)
364 return text 364 return text
365 365
627 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80]) 627 node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
628 link = linkmapper(cs) 628 link = linkmapper(cs)
629 if node in self.nodemap: 629 if node in self.nodemap:
630 # this can happen if two branches make the same change 630 # this can happen if two branches make the same change
631 # if unique: 631 # if unique:
632 # raise RevlogError("already have %s" % hex(node[:4])) 632 # raise RevlogError(_("already have %s") % hex(node[:4]))
633 chain = node 633 chain = node
634 continue 634 continue
635 delta = chunk[80:] 635 delta = chunk[80:]
636 636
637 if not chain: 637 if not chain:
638 # retrieve the parent revision of the delta chain 638 # retrieve the parent revision of the delta chain
639 chain = p1 639 chain = p1
640 if not chain in self.nodemap: 640 if not chain in self.nodemap:
641 raise RevlogError("unknown base %s" % short(chain[:4])) 641 raise RevlogError(_("unknown base %s") % short(chain[:4]))
642 642
643 # full versions are inserted when the needed deltas become 643 # full versions are inserted when the needed deltas become
644 # comparable to the uncompressed text or when the previous 644 # comparable to the uncompressed text or when the previous
645 # version is not the one we have a delta against. We use 645 # version is not the one we have a delta against. We use
646 # the size of the previous full rev as a proxy for the 646 # the size of the previous full rev as a proxy for the
655 ifh.flush() 655 ifh.flush()
656 text = self.revision(chain) 656 text = self.revision(chain)
657 text = self.patches(text, [delta]) 657 text = self.patches(text, [delta])
658 chk = self.addrevision(text, transaction, link, p1, p2) 658 chk = self.addrevision(text, transaction, link, p1, p2)
659 if chk != node: 659 if chk != node:
660 raise RevlogError("consistency error adding group") 660 raise RevlogError(_("consistency error adding group"))
661 measure = len(text) 661 measure = len(text)
662 else: 662 else:
663 e = (end, len(cdelta), self.base(t), link, p1, p2, node) 663 e = (end, len(cdelta), self.base(t), link, p1, p2, node)
664 self.index.append(e) 664 self.index.append(e)
665 self.nodemap[node] = r 665 self.nodemap[node] = r