~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-23 17:54:07 UTC
  • mfrom: (5387 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5390.
  • Revision ID: john@arbash-meinel.com-20100823175407-yomx2h1x5v8amt6w
Merge bzr.dev 5387 in prep for NEWS

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
2939
2941
        previous_entries = dict((head, parent_candiate_entries[head]) for head
2940
2942
            in heads)
2941
2943
        self.snapshot_ie(previous_entries, ie, w, rev_id)
2942
 
        del ie.text_id
2943
2944
 
2944
2945
    def get_parent_map(self, revision_ids):
2945
2946
        """See graph.StackedParentsProvider.get_parent_map"""