comparison mercurial/streamclone.py @ 6953:63b5f4c73c98

i18n: mark strings for translation in Mercurial
author Martin Geisler <mg@daimi.au.dk>
date Sun, 31 Aug 2008 16:12:02 +0200
parents 87abfefafe02
children 810ca383da9c
comparison
equal deleted inserted replaced
6952:3fffba1c87d0 6953:63b5f4c73c98
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 import util, lock 8 import util, lock
9 from i18n import _
9 10
10 class StreamException(Exception): 11 class StreamException(Exception):
11 def __init__(self, code): 12 def __init__(self, code):
12 Exception.__init__(self) 13 Exception.__init__(self)
13 self.code = code 14 self.code = code
40 entries = [] 41 entries = []
41 total_bytes = 0 42 total_bytes = 0
42 try: 43 try:
43 l = None 44 l = None
44 try: 45 try:
45 repo.ui.debug('scanning\n') 46 repo.ui.debug(_('scanning\n'))
46 # get consistent snapshot of repo, lock during scan 47 # get consistent snapshot of repo, lock during scan
47 l = repo.lock() 48 l = repo.lock()
48 for name, ename, size in repo.store.walk(): 49 for name, ename, size in repo.store.walk():
49 entries.append((name, size)) 50 entries.append((name, size))
50 total_bytes += size 51 total_bytes += size
52 del l 53 del l
53 except (lock.LockHeld, lock.LockUnavailable), inst: 54 except (lock.LockHeld, lock.LockUnavailable), inst:
54 raise StreamException(2) 55 raise StreamException(2)
55 56
56 yield '0\n' 57 yield '0\n'
57 repo.ui.debug('%d files, %d bytes to transfer\n' % 58 repo.ui.debug(_('%d files, %d bytes to transfer\n') %
58 (len(entries), total_bytes)) 59 (len(entries), total_bytes))
59 yield '%d %d\n' % (len(entries), total_bytes) 60 yield '%d %d\n' % (len(entries), total_bytes)
60 for name, size in entries: 61 for name, size in entries:
61 repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) 62 repo.ui.debug(_('sending %s (%d bytes)\n') % (name, size))
62 yield '%s\0%d\n' % (name, size) 63 yield '%s\0%d\n' % (name, size)
63 for chunk in util.filechunkiter(repo.sopener(name), limit=size): 64 for chunk in util.filechunkiter(repo.sopener(name), limit=size):
64 yield chunk 65 yield chunk