~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Martin Pool
  • Date: 2005-09-30 07:38:34 UTC
  • mto: (1185.14.2)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: mbp@sourcefrog.net-20050930073834-e2813ae9936fb006
- fix cloning of part of a branch

- add test for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        ## # basis branches currently disabled for weave format
87
87
        ## self.assertFalse(br_b.last_revision() in br_c.revision_history())
88
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
        
89
104
        
90
105
# TODO: rewrite this as a regular unittest, without relying on the displayed output        
91
106
#         >>> from bzrlib.commit import commit