~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/whitebox.py

  • Committer: Martin Pool
  • Date: 2005-09-30 00:58:02 UTC
  • mto: (1185.14.2)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: mbp@sourcefrog.net-20050930005802-721cfc318e393817
- copy_branch creates destination if it doesn't exist

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/python
2
 
 
3
1
import os
4
2
import unittest
5
3
 
11
9
class TestBranch(TestCaseInTempDir):
12
10
 
13
11
    def test_unknowns(self):
14
 
        b = Branch('.', init=True)
 
12
        b = Branch.initialize('.')
15
13
 
16
14
        self.build_tree(['hello.txt',
17
15
                         'hello.txt~'])
22
20
    def test_no_changes(self):
23
21
        from bzrlib.errors import PointlessCommit
24
22
        
25
 
        b = Branch('.', init=True)
 
23
        b = Branch.initialize('.')
26
24
 
27
25
        self.build_tree(['hello.txt'])
28
26
 
47
45
        b.commit('commit pointless revision with one file',
48
46
                 allow_pointless=True)
49
47
 
50
 
        b.add_pending_merge('mbp@892739123-2005-123123')
51
 
        b.commit('commit new merge with no text changes',
52
 
                 allow_pointless=False)
53
48
        
54
49
 
55
50
 
76
71
 
77
72
    def test_pending_merges(self):
78
73
        """Tracking pending-merged revisions."""
79
 
        b = Branch('.', init=True)
 
74
        print "GHOST SUPPORT REMOVED"
 
75
        return
 
76
 
 
77
        b = Branch.initialize('.')
80
78
 
81
79
        self.assertEquals(b.pending_merges(), [])
82
80
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
96
94
                           'wibble@fofof--20050401--1928390812')
97
95
        # list should be cleared when we do a commit
98
96
        self.assertEquals(b.pending_merges(), [])
99
 
        
 
97
 
 
98
 
 
99
class MoreTests(TestCaseInTempDir):
 
100
 
100
101
    def test_revert(self):
101
102
        """Test selected-file revert"""
102
 
        b = Branch('.', init=True)
 
103
        b = Branch.initialize('.')
103
104
 
104
105
        self.build_tree(['hello.txt'])
105
106
        file('hello.txt', 'w').write('initial hello')
126
127
 
127
128
    def test_rename_dirs(self):
128
129
        """Test renaming directories and the files within them."""
129
 
        b = Branch('.', init=True)
 
130
        b = Branch.initialize('.')
130
131
        self.build_tree(['dir/', 'dir/sub/', 'dir/sub/file'])
131
132
        b.add(['dir', 'dir/sub', 'dir/sub/file'])
132
133
 
197
198
            # directory, or nearby
198
199
            os.chdir(dtmp)
199
200
 
200
 
            self.assertEqual(rp('foo/bar/quux'), 'foo/bar/quux')
 
201
            FOO_BAR_QUUX = os.path.join('foo', 'bar', 'quux')
 
202
            self.assertEqual(rp('foo/bar/quux'), FOO_BAR_QUUX)
201
203
 
202
204
            self.assertEqual(rp('foo'), 'foo')
203
205