~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-08-20 11:10:10 UTC
  • mfrom: (5384.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100820111010-xwracendg19hytgt
(vila) `bzr remove` now just backs up changed files instead of
        annoying you (Marius Kruger)

Show diffs side-by-side

added added

removed removed

Lines of Context:
615
615
        """
616
616
        raise NotImplementedError(self.create_workingtree)
617
617
 
 
618
    def generate_backup_name(self, base):
 
619
        """Generate a non-existing backup file name based on base."""
 
620
        counter = 1
 
621
        name = "%s.~%d~" % (base, counter)
 
622
        while self.root_transport.has(name):
 
623
            counter += 1
 
624
            name = "%s.~%d~" % (base, counter)
 
625
        return name
 
626
 
618
627
    def backup_bzrdir(self):
619
628
        """Backup this bzr control directory.
620
629
 
621
630
        :return: Tuple with old path name and new path name
622
631
        """
623
 
        def name_gen(base='backup.bzr'):
624
 
            counter = 1
625
 
            name = "%s.~%d~" % (base, counter)
626
 
            while self.root_transport.has(name):
627
 
                counter += 1
628
 
                name = "%s.~%d~" % (base, counter)
629
 
            return name
630
632
 
631
 
        backup_dir=name_gen()
 
633
        backup_dir=self.generate_backup_name('backup.bzr')
632
634
        pb = ui.ui_factory.nested_progress_bar()
633
635
        try:
634
636
            # FIXME: bug 300001 -- the backup fails if the backup directory