~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Parth Malwankar
  • Date: 2010-02-15 08:11:45 UTC
  • mto: This revision was merged to the branch mainline in revision 5048.
  • Revision ID: parth.malwankar@gmail.com-20100215081145-c4bik00ctv377k1d
name_gen now works with all transports.
coding convention fix (lower case local variables).

Show diffs side-by-side

added added

removed removed

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