~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/bzrdir.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-20 14:38:17 UTC
  • mfrom: (6150.3.12 i18n-more-gettext)
  • Revision ID: pqm@pqm.ubuntu.com-20110920143817-505fvpundix8tqv8
(jr) adding gettext() to more strings
 (Jonathan Riddell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
    weave,
45
45
    xml5,
46
46
    )
 
47
from bzrlib.i18n import gettext
47
48
from bzrlib.store.versioned import VersionedFileStore
48
49
from bzrlib.transactions import WriteTransaction
49
50
from bzrlib.transport import (
222
223
        """See Converter.convert()."""
223
224
        self.bzrdir = to_convert
224
225
        if pb is not None:
225
 
            warnings.warn("pb parameter to convert() is deprecated")
 
226
            warnings.warn(gettext("pb parameter to convert() is deprecated"))
226
227
        self.pb = ui.ui_factory.nested_progress_bar()
227
228
        try:
228
 
            ui.ui_factory.note('starting upgrade from format 4 to 5')
 
229
            ui.ui_factory.note(gettext('starting upgrade from format 4 to 5'))
229
230
            if isinstance(self.bzrdir.transport, local.LocalTransport):
230
231
                self.bzrdir.get_workingtree_transport(None).delete('stat-cache')
231
232
            self._convert_to_weaves()
234
235
            self.pb.finished()
235
236
 
236
237
    def _convert_to_weaves(self):
237
 
        ui.ui_factory.note('note: upgrade may be faster if all store files are ungzipped first')
 
238
        ui.ui_factory.note(gettext(
 
239
          'note: upgrade may be faster if all store files are ungzipped first'))
238
240
        try:
239
241
            # TODO permissions
240
242
            stat = self.bzrdir.transport.stat('weaves')
263
265
        self.pb.clear()
264
266
        to_import = self._make_order()
265
267
        for i, rev_id in enumerate(to_import):
266
 
            self.pb.update('converting revision', i, len(to_import))
 
268
            self.pb.update(gettext('converting revision'), i, len(to_import))
267
269
            self._convert_one_rev(rev_id)
268
270
        self.pb.clear()
269
271
        self._write_all_weaves()
270
272
        self._write_all_revs()
271
 
        ui.ui_factory.note('upgraded to weaves:')
272
 
        ui.ui_factory.note('  %6d revisions and inventories' % len(self.revisions))
273
 
        ui.ui_factory.note('  %6d revisions not present' % len(self.absent_revisions))
274
 
        ui.ui_factory.note('  %6d texts' % self.text_count)
 
273
        ui.ui_factory.note(gettext('upgraded to weaves:'))
 
274
        ui.ui_factory.note('  ' + gettext('%6d revisions and inventories') %
 
275
                                                        len(self.revisions))
 
276
        ui.ui_factory.note('  ' + gettext('%6d revisions not present') %
 
277
                                                    len(self.absent_revisions))
 
278
        ui.ui_factory.note('  ' + gettext('%6d texts') % self.text_count)
275
279
        self._cleanup_spare_files_after_format4()
276
280
        self.branch._transport.put_bytes(
277
281
            'branch-format',
307
311
        try:
308
312
            i = 0
309
313
            for file_id, file_weave in self.text_weaves.items():
310
 
                self.pb.update('writing weave', i, len(self.text_weaves))
 
314
                self.pb.update(gettext('writing weave'), i,
 
315
                                                        len(self.text_weaves))
311
316
                weaves._put_weave(file_id, file_weave, transaction)
312
317
                i += 1
313
 
            self.pb.update('inventory', 0, 1)
 
318
            self.pb.update(gettext('inventory'), 0, 1)
314
319
            controlweaves._put_weave('inventory', self.inv_weave, transaction)
315
 
            self.pb.update('inventory', 1, 1)
 
320
            self.pb.update(gettext('inventory'), 1, 1)
316
321
        finally:
317
322
            self.pb.clear()
318
323
 
329
334
            lambda:True, lambda:True)
330
335
        try:
331
336
            for i, rev_id in enumerate(self.converted_revs):
332
 
                self.pb.update('write revision', i, len(self.converted_revs))
 
337
                self.pb.update(gettext('write revision'), i,
 
338
                                                len(self.converted_revs))
333
339
                text = serializer_v5.write_revision_to_string(
334
340
                    self.revisions[rev_id])
335
341
                key = (rev_id,)
342
348
 
343
349
        Any parents not either loaded or abandoned get queued to be
344
350
        loaded."""
345
 
        self.pb.update('loading revision',
 
351
        self.pb.update(gettext('loading revision'),
346
352
                       len(self.revisions),
347
353
                       len(self.known_revisions))
348
354
        if not self.branch.repository.has_revision(rev_id):
349
355
            self.pb.clear()
350
 
            ui.ui_factory.note('revision {%s} not present in branch; '
351
 
                         'will be converted as a ghost' %
 
356
            ui.ui_factory.note(gettext('revision {%s} not present in branch; '
 
357
                         'will be converted as a ghost') %
352
358
                         rev_id)
353
359
            self.absent_revisions.add(rev_id)
354
360
        else:
487
493
        self.bzrdir = to_convert
488
494
        pb = ui.ui_factory.nested_progress_bar()
489
495
        try:
490
 
            ui.ui_factory.note('starting upgrade from format 5 to 6')
 
496
            ui.ui_factory.note(gettext('starting upgrade from format 5 to 6'))
491
497
            self._convert_to_prefixed()
492
498
            return BzrDir.open(self.bzrdir.user_url)
493
499
        finally:
497
503
        from bzrlib.store import TransportStore
498
504
        self.bzrdir.transport.delete('branch-format')
499
505
        for store_name in ["weaves", "revision-store"]:
500
 
            ui.ui_factory.note("adding prefixes to %s" % store_name)
 
506
            ui.ui_factory.note(gettext("adding prefixes to %s") % store_name)
501
507
            store_transport = self.bzrdir.transport.clone(store_name)
502
508
            store = TransportStore(store_transport, prefixed=True)
503
509
            for urlfilename in store_transport.list_dir('.'):
537
543
        self.dir_mode = self.bzrdir._get_dir_mode()
538
544
        self.file_mode = self.bzrdir._get_file_mode()
539
545
 
540
 
        ui.ui_factory.note('starting upgrade from format 6 to metadir')
 
546
        ui.ui_factory.note(gettext('starting upgrade from format 6 to metadir'))
541
547
        self.bzrdir.transport.put_bytes(
542
548
                'branch-format',
543
549
                "Converting to format 6",
545
551
        # its faster to move specific files around than to open and use the apis...
546
552
        # first off, nuke ancestry.weave, it was never used.
547
553
        try:
548
 
            self.step('Removing ancestry.weave')
 
554
            self.step(gettext('Removing ancestry.weave'))
549
555
            self.bzrdir.transport.delete('ancestry.weave')
550
556
        except errors.NoSuchFile:
551
557
            pass
552
558
        # find out whats there
553
 
        self.step('Finding branch files')
 
559
        self.step(gettext('Finding branch files'))
554
560
        last_revision = self.bzrdir.open_branch().last_revision()
555
561
        bzrcontents = self.bzrdir.transport.list_dir('.')
556
562
        for name in bzrcontents:
560
566
        repository_names = [('inventory.weave', True),
561
567
                            ('revision-store', True),
562
568
                            ('weaves', True)]
563
 
        self.step('Upgrading repository  ')
 
569
        self.step(gettext('Upgrading repository') + '  ')
564
570
        self.bzrdir.transport.mkdir('repository', mode=self.dir_mode)
565
571
        self.make_lock('repository')
566
572
        # we hard code the formats here because we are converting into
570
576
        for entry in repository_names:
571
577
            self.move_entry('repository', entry)
572
578
 
573
 
        self.step('Upgrading branch      ')
 
579
        self.step(gettext('Upgrading branch') + '      ')
574
580
        self.bzrdir.transport.mkdir('branch', mode=self.dir_mode)
575
581
        self.make_lock('branch')
576
582
        self.put_format('branch', BzrBranchFormat5())
593
599
        else:
594
600
            has_checkout = True
595
601
        if not has_checkout:
596
 
            ui.ui_factory.note('No working tree.')
 
602
            ui.ui_factory.note(gettext('No working tree.'))
597
603
            # If some checkout files are there, we may as well get rid of them.
598
604
            for name, mandatory in checkout_files:
599
605
                if name in bzrcontents:
600
606
                    self.bzrdir.transport.delete(name)
601
607
        else:
602
608
            from bzrlib.workingtree_3 import WorkingTreeFormat3
603
 
            self.step('Upgrading working tree')
 
609
            self.step(gettext('Upgrading working tree'))
604
610
            self.bzrdir.transport.mkdir('checkout', mode=self.dir_mode)
605
611
            self.make_lock('checkout')
606
612
            self.put_format(
621
627
 
622
628
    def make_lock(self, name):
623
629
        """Make a lock for the new control dir name."""
624
 
        self.step('Make %s lock' % name)
 
630
        self.step(gettext('Make %s lock') % name)
625
631
        ld = lockdir.LockDir(self.bzrdir.transport,
626
632
                             '%s/lock' % name,
627
633
                             file_modebits=self.file_mode,
632
638
        """Move then entry name into new_dir."""
633
639
        name = entry[0]
634
640
        mandatory = entry[1]
635
 
        self.step('Moving %s' % name)
 
641
        self.step(gettext('Moving %s') % name)
636
642
        try:
637
643
            self.bzrdir.transport.move(name, '%s/%s' % (new_dir, name))
638
644
        except errors.NoSuchFile: