~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Alexander Belchenko
  • Date: 2007-11-19 22:54:30 UTC
  • mfrom: (3006 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3008.
  • Revision ID: bialix@ukr.net-20071119225430-x0ewosrsagis0yno
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        except errors.NotBranchError:
210
210
            pass
211
211
        try:
212
 
            self.open_workingtree().clone(result)
213
 
        except (errors.NoWorkingTree, errors.NotLocalUrl):
214
 
            pass
 
212
            result_repo = result.find_repository()
 
213
        except errors.NoRepositoryPresent:
 
214
            result_repo = None
 
215
        if result_repo is None or result_repo.make_working_trees():
 
216
            try:
 
217
                self.open_workingtree().clone(result)
 
218
            except (errors.NoWorkingTree, errors.NotLocalUrl):
 
219
                pass
215
220
        return result
216
221
 
217
222
    # TODO: This should be given a Transport, and should chdir up; otherwise
370
375
                                               format=format).bzrdir
371
376
        return bzrdir.create_workingtree()
372
377
 
373
 
    def create_workingtree(self, revision_id=None):
 
378
    def create_workingtree(self, revision_id=None, from_branch=None):
374
379
        """Create a working tree at this BzrDir.
375
380
        
376
 
        revision_id: create it as of this revision id.
 
381
        :param revision_id: create it as of this revision id.
 
382
        :param from_branch: override bzrdir branch (for lightweight checkouts)
377
383
        """
378
384
        raise NotImplementedError(self.create_workingtree)
379
385
 
687
693
        raise NotImplementedError(self.open_repository)
688
694
 
689
695
    def open_workingtree(self, _unsupported=False,
690
 
            recommend_upgrade=True):
 
696
                         recommend_upgrade=True, from_branch=None):
691
697
        """Open the workingtree object at this BzrDir if one is present.
692
698
 
693
699
        :param recommend_upgrade: Optional keyword parameter, when True (the
694
700
            default), emit through the ui module a recommendation that the user
695
701
            upgrade the working tree when the workingtree being opened is old
696
702
            (but still fully supported).
 
703
        :param from_branch: override bzrdir branch (for lightweight checkouts)
697
704
        """
698
705
        raise NotImplementedError(self.open_workingtree)
699
706
 
922
929
            raise errors.IncompatibleFormat('shared repository', self._format)
923
930
        return self.open_repository()
924
931
 
925
 
    def create_workingtree(self, revision_id=None):
 
932
    def create_workingtree(self, revision_id=None, from_branch=None):
926
933
        """See BzrDir.create_workingtree."""
927
934
        # this looks buggy but is not -really-
928
935
        # because this format creates the workingtree when the bzrdir is
1100
1107
        """See BzrDir.create_repository."""
1101
1108
        return self._format.repository_format.initialize(self, shared)
1102
1109
 
1103
 
    def create_workingtree(self, revision_id=None):
 
1110
    def create_workingtree(self, revision_id=None, from_branch=None):
1104
1111
        """See BzrDir.create_workingtree."""
1105
 
        from bzrlib.workingtree import WorkingTreeFormat
1106
 
        return self._format.workingtree_format.initialize(self, revision_id)
 
1112
        return self._format.workingtree_format.initialize(
 
1113
            self, revision_id, from_branch=from_branch)
1107
1114
 
1108
1115
    def destroy_workingtree(self):
1109
1116
        """See BzrDir.destroy_workingtree."""