~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-18 04:04:19 UTC
  • mfrom: (5035.4.8 335033-upgrade)
  • Revision ID: pqm@pqm.ubuntu.com-20100218040419-l1gkx8dm60czagfq
(mbp, for parthm) copy to backup.bzr.~N~ before upgrading

Show diffs side-by-side

added added

removed removed

Lines of Context:
580
580
 
581
581
        :return: Tuple with old path name and new path name
582
582
        """
 
583
        def name_gen(base='backup.bzr'):
 
584
            counter = 1
 
585
            name = "%s.~%d~" % (base, counter)
 
586
            while self.root_transport.has(name):
 
587
                counter += 1
 
588
                name = "%s.~%d~" % (base, counter)
 
589
            return name
 
590
 
 
591
        backup_dir=name_gen()
583
592
        pb = ui.ui_factory.nested_progress_bar()
584
593
        try:
585
594
            # FIXME: bug 300001 -- the backup fails if the backup directory
589
598
            # FIXME: bug 262450 -- the backup directory should have the same
590
599
            # permissions as the .bzr directory (probably a bug in copy_tree)
591
600
            old_path = self.root_transport.abspath('.bzr')
592
 
            new_path = self.root_transport.abspath('backup.bzr')
 
601
            new_path = self.root_transport.abspath(backup_dir)
593
602
            ui.ui_factory.note('making backup of %s\n  to %s' % (old_path, new_path,))
594
 
            self.root_transport.copy_tree('.bzr', 'backup.bzr')
 
603
            self.root_transport.copy_tree('.bzr', backup_dir)
595
604
            return (old_path, new_path)
596
605
        finally:
597
606
            pb.finished()