/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/selftest/whitebox.py

  • Committer: Martin Pool
  • Date: 2005-07-04 07:34:19 UTC
  • Revision ID: mbp@sourcefrog.net-20050704073419-44eb753d5556a4d0
- rename control file to pending-merges

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
 
22
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
23
class ValidateRevisionId(TestBase):
59
24
    def runTest(self):
60
25
        from bzrlib.revision import validate_revision_id
80
45
 
81
46
 
82
47
 
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
48
class Revert(InTempDir):
119
49
    """Test selected-file revert"""
120
50
    def runTest(self):
193
123
        
194
124
        savedir = os.getcwdu()
195
125
        dtmp = tempfile.mkdtemp()
196
 
        # On Mac OSX, /tmp actually expands to /private/tmp
197
 
        dtmp = os.path.realpath(dtmp)
198
126
 
199
127
        def rp(p):
200
128
            return _relpath(dtmp, p)
238
166
        finally:
239
167
            os.chdir(savedir)
240
168
            shutil.rmtree(dtmp)
241
 
 
242
 
 
243
 
 
244
 
 
245
 
TEST_CLASSES = [Unknowns,
246
 
                ValidateRevisionId,
247
 
                PendingMerges,
248
 
                Revert,
249
 
                RenameDirs,
250
 
                BranchPathTestCase,
251
 
                ]