~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testrevisionnamespaces.py

  • Committer: Robert Collins
  • Date: 2005-10-10 23:18:27 UTC
  • mfrom: (1437)
  • mto: This revision was merged to the branch mainline in revision 1438.
  • Revision ID: robertc@robertcollins.net-20051010231827-f9e2dda2e92bf565
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import os
18
18
import time
 
19
 
 
20
from bzrlib.branch import Branch
19
21
from bzrlib.selftest import TestCaseInTempDir
20
22
from bzrlib.errors import NoCommonAncestor, NoCommits
 
23
from bzrlib.errors import NoSuchRevision
21
24
from bzrlib.clone import copy_branch
22
25
from bzrlib.merge import merge
 
26
from bzrlib.revisionspec import RevisionSpec
23
27
 
24
28
class TestRevisionNamespaces(TestCaseInTempDir):
25
29
 
27
31
        """Test revision specifiers.
28
32
 
29
33
        These identify revisions by date, etc."""
30
 
        from bzrlib.errors import NoSuchRevision
31
 
        from bzrlib.branch import Branch
32
 
        from bzrlib.revisionspec import RevisionSpec
33
34
 
34
35
        b = Branch.initialize('.')
35
36
 
78
79
                          'b@r-0-4')
79
80
        self.assertEquals(RevisionSpec('ancestor:.').in_history(b3).rev_id,
80
81
                          'b@r-0-4')
 
82
 
 
83
    def test_branch_namespace(self):
 
84
        """Ensure that the branch namespace pulls in the requisite content."""
 
85
        self.build_tree(['branch1/', 'branch1/file', 'branch2/'])
 
86
        branch = Branch.initialize('branch1')
 
87
        branch.add(['file'])
 
88
        branch.commit('add file')
 
89
        copy_branch(branch, 'branch2')
 
90
        print >> open('branch2/file', 'w'), 'new content'
 
91
        branch2 = Branch.open('branch2')
 
92
        branch2.commit('update file', rev_id='A')
 
93
        spec = RevisionSpec('branch:./branch2/.bzr/../')
 
94
        rev_info = spec.in_history(branch)
 
95
        self.assertEqual(rev_info, (None, 'A'))
 
96