~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/whitebox.py

  • Committer: Martin Pool
  • Date: 2005-06-27 01:26:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050627012611-4effb7007553fde1
- tweak rsync upload script

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
                          ['hello.txt'])
20
20
 
21
21
 
22
 
 
23
 
class NoChanges(InTempDir):
24
 
    def runTest(self):
25
 
        from bzrlib.errors import PointlessCommit
26
 
        
27
 
        b = Branch('.', init=True)
28
 
 
29
 
        self.build_tree(['hello.txt'])
30
 
 
31
 
        self.assertRaises(PointlessCommit,
32
 
                          b.commit,
33
 
                          'commit without adding',
34
 
                          allow_pointless=False)
35
 
 
36
 
        b.commit('commit pointless tree',
37
 
                 allow_pointless=True)
38
 
 
39
 
        b.add('hello.txt')
40
 
        
41
 
        b.commit('commit first added file',
42
 
                 allow_pointless=False)
43
 
        
44
 
        self.assertRaises(PointlessCommit,
45
 
                          b.commit,
46
 
                          'commit after adding file',
47
 
                          allow_pointless=False)
48
 
        
49
 
        b.commit('commit pointless revision with one file',
50
 
                 allow_pointless=True)
51
 
 
52
 
        b.add_pending_merge('mbp@892739123-2005-123123')
53
 
        b.commit('commit new merge with no text changes',
54
 
                 allow_pointless=False)
55
 
        
56
 
 
57
 
 
58
 
class ValidateRevisionId(TestBase):
59
 
    def runTest(self):
60
 
        from bzrlib.revision import validate_revision_id
61
 
        validate_revision_id('mbp@sourcefrog.net-20050311061123-96a255005c7c9dbe')
62
 
        
63
 
        self.assertRaises(ValueError,
64
 
                          validate_revision_id,
65
 
                          ' asdkjas')
66
 
 
67
 
 
68
 
        self.assertRaises(ValueError,
69
 
                          validate_revision_id,
70
 
                          'mbp@sourcefrog.net-20050311061123-96a255005c7c9dbe\n')
71
 
 
72
 
 
73
 
        self.assertRaises(ValueError,
74
 
                          validate_revision_id,
75
 
                          ' mbp@sourcefrog.net-20050311061123-96a255005c7c9dbe')
76
 
 
77
 
        self.assertRaises(ValueError,
78
 
                          validate_revision_id,
79
 
                          'Martin Pool <mbp@sourcefrog.net>-20050311061123-96a255005c7c9dbe')
80
 
 
81
 
 
82
 
 
83
 
class PendingMerges(InTempDir):
84
 
    """Tracking pending-merged revisions."""
85
 
    def runTest(self):
86
 
        b = Branch('.', init=True)
87
 
 
88
 
        self.assertEquals(b.pending_merges(), [])
89
 
        
90
 
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
91
 
        
92
 
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
93
 
    
94
 
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
95
 
        
96
 
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
97
 
 
98
 
        b.add_pending_merge('wibble@fofof--20050401--1928390812')
99
 
        self.assertEquals(b.pending_merges(),
100
 
                          ['foo@azkhazan-123123-abcabc',
101
 
                           'wibble@fofof--20050401--1928390812'])
102
 
 
103
 
        b.commit("commit from base with two merges")
104
 
 
105
 
        rev = b.get_revision(b.revision_history()[0])
106
 
        self.assertEquals(len(rev.parents), 2)
107
 
        self.assertEquals(rev.parents[0].revision_id,
108
 
                          'foo@azkhazan-123123-abcabc')
109
 
        self.assertEquals(rev.parents[1].revision_id,
110
 
                           'wibble@fofof--20050401--1928390812')
111
 
 
112
 
        # list should be cleared when we do a commit
113
 
        self.assertEquals(b.pending_merges(), [])
114
 
        
115
 
        
116
 
        
117
 
 
118
22
class Revert(InTempDir):
119
23
    """Test selected-file revert"""
120
24
    def runTest(self):
193
97
        
194
98
        savedir = os.getcwdu()
195
99
        dtmp = tempfile.mkdtemp()
196
 
        # On Mac OSX, /tmp actually expands to /private/tmp
197
 
        dtmp = os.path.realpath(dtmp)
198
100
 
199
101
        def rp(p):
200
102
            return _relpath(dtmp, p)
238
140
        finally:
239
141
            os.chdir(savedir)
240
142
            shutil.rmtree(dtmp)
241
 
 
242
 
 
243
 
 
244
 
 
245
 
TEST_CLASSES = [Unknowns,
246
 
                ValidateRevisionId,
247
 
                PendingMerges,
248
 
                Revert,
249
 
                RenameDirs,
250
 
                BranchPathTestCase,
251
 
                ]