~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Robert Collins
  • Date: 2005-10-02 01:53:46 UTC
  • mfrom: (1393.1.23)
  • Revision ID: robertc@robertcollins.net-20051002015346-587422189352289e
merge from upstream newformat

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
 
from bzrlib.branch import Branch, copy_branch
 
18
from bzrlib.branch import Branch
 
19
from bzrlib.clone import copy_branch
19
20
from bzrlib.commit import commit
20
21
from bzrlib.errors import NoSuchRevision, UnlistableBranch
21
22
from bzrlib.selftest import TestCaseInTempDir
82
83
        os.mkdir('c')
83
84
        br_c = copy_branch(br_a, 'c', basis_branch=br_b)
84
85
        self.assertEqual(br_a.revision_history(), br_c.revision_history())
85
 
        assert br_b.last_revision() not in br_c.revision_history()
86
 
        br_c.get_revision(br_b.last_revision())
 
86
        ## # basis branches currently disabled for weave format
 
87
        ## self.assertFalse(br_b.last_revision() in br_c.revision_history())
 
88
        ## br_c.get_revision(br_b.last_revision())
 
89
 
 
90
    def test_copy_partial(self):
 
91
        """Copy only part of the history of a branch."""
 
92
        self.build_tree(['a/', 'a/one'])
 
93
        br_a = Branch.initialize('a')
 
94
        br_a.add(['one'])
 
95
        br_a.commit('commit one', rev_id='u@d-1')
 
96
        self.build_tree(['a/two'])
 
97
        br_a.add(['two'])
 
98
        br_a.commit('commit two', rev_id='u@d-2')
 
99
        br_b = copy_branch(br_a, 'b', revision='u@d-1')
 
100
        self.assertEqual(br_b.last_revision(), 'u@d-1')
 
101
        self.assertTrue(os.path.exists('b/one'))
 
102
        self.assertFalse(os.path.exists('b/two'))
 
103
        
 
104
        
87
105
# TODO: rewrite this as a regular unittest, without relying on the displayed output        
88
106
#         >>> from bzrlib.commit import commit
89
107
#         >>> bzrlib.trace.silent = True