~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revisionnamespaces.py

first cut at merge from integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2004, 2005 by Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
23
23
from bzrlib.errors import NoCommonAncestor, NoCommits
24
24
from bzrlib.errors import NoSuchRevision
25
25
from bzrlib.revisionspec import RevisionSpec
 
26
from bzrlib.workingtree import WorkingTree
26
27
 
27
28
 
28
29
class TestRevisionNamespaces(TestCaseWithTransport):
50
51
 
51
52
        self.assertEquals(RevisionSpec('date:today').in_history(b),
52
53
                          (2, 'a@r-0-2'))
53
 
        self.assertRaises(NoSuchRevision,
54
 
                          RevisionSpec('date:tomorrow').in_history, b)
55
54
        self.assertEquals(RevisionSpec('date:yesterday').in_history(b),
56
55
                          (1, 'a@r-0-1'))
57
56
        self.assertEquals(RevisionSpec('before:date:today').in_history(b),
71
70
        b2 = wt2.branch
72
71
        self.assertRaises(NoCommits, RevisionSpec('ancestor:.').in_history, b2)
73
72
 
74
 
        d3 = b.bzrdir.sprout('copy')
75
 
        b3 = d3.open_branch()
76
 
        wt3 = d3.open_workingtree()
 
73
        os.mkdir('copy')
 
74
        b3 = b.clone('copy')
 
75
        wt3 = WorkingTree('copy', b3)
77
76
        wt3.commit('Commit four', rev_id='b@r-0-4')
78
77
        self.assertEquals(RevisionSpec('ancestor:.').in_history(b3).rev_id,
79
78
                          'a@r-0-3')
95
94
        branch = wt.branch
96
95
        wt.add(['file'])
97
96
        wt.commit('add file')
98
 
        d2 = branch.bzrdir.sprout('branch2')
 
97
        branch.clone('branch2')
99
98
        print >> open('branch2/file', 'w'), 'new content'
100
 
        branch2 = d2.open_branch()
101
 
        d2.open_workingtree().commit('update file', rev_id='A')
 
99
        branch2 = Branch.open('branch2')
 
100
        WorkingTree('branch2', branch2).commit('update file', rev_id='A')
102
101
        spec = RevisionSpec('branch:./branch2/.bzr/../')
103
102
        rev_info = spec.in_history(branch)
104
103
        self.assertEqual(rev_info, (None, 'A'))