~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2006-02-13 10:54:50 UTC
  • mto: (1534.5.2 bzr-dir)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060213105450-ecb3a07f7774a697
Cloning of repos preserves shared and make-working-tree attributes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
        """Make a complete copy of the content in self into destination."""
257
257
        destination.lock_write()
258
258
        try:
 
259
            try:
 
260
                destination.set_make_working_trees(self.make_working_trees())
 
261
            except NotImplementedError:
 
262
                pass
259
263
            # optimised paths:
260
264
            # compatible stores
261
265
            if self._compatible_formats(destination):
321
325
                       bzrdir.BzrDirFormat6)):
322
326
            result = a_bzrdir.open_repository()
323
327
        else:
324
 
            result = self._format.initialize(a_bzrdir)
 
328
            result = self._format.initialize(a_bzrdir, shared=self.is_shared())
325
329
        self.copy_content_into(result, revision_id, basis)
326
330
        return result
327
331
 
575
579
        return self.control_files.get_transaction()
576
580
 
577
581
    @needs_write_lock
 
582
    def set_make_working_trees(self, new_value):
 
583
        """Set the policy flag for making working trees when creating branches.
 
584
 
 
585
        This only applies to branches that use this repository.
 
586
 
 
587
        The default is 'True'.
 
588
        :param new_value: True to restore the default, False to disable making
 
589
                          working trees.
 
590
        """
 
591
        # FIXME: split out into a new class/strategy ?
 
592
        if isinstance(self._format, (RepositoryFormat4,
 
593
                                     RepositoryFormat5,
 
594
                                     RepositoryFormat6)):
 
595
            raise NotImplementedError(self.set_make_working_trees)
 
596
        if new_value:
 
597
            try:
 
598
                self.control_files._transport.delete('no-working-trees')
 
599
            except errors.NoSuchFile:
 
600
                return
 
601
        else:
 
602
            self.control_files.put_utf8('no-working-trees', '')
 
603
    
 
604
    def make_working_trees(self):
 
605
        """Returns the policy for making working trees on new branches."""
 
606
        # FIXME: split out into a new class/strategy ?
 
607
        if isinstance(self._format, (RepositoryFormat4,
 
608
                                     RepositoryFormat5,
 
609
                                     RepositoryFormat6)):
 
610
            return True
 
611
        return self.control_files._transport.has('no-working-trees')
 
612
 
 
613
    @needs_write_lock
578
614
    def sign_revision(self, revision_id, gpg_strategy):
579
615
        plaintext = Testament.from_revision(self, revision_id).as_short_text()
580
616
        self.store_revision_signature(gpg_strategy, plaintext, revision_id)