~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/whitebox.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-15 21:35:53 UTC
  • mfrom: (907.1.57)
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050915213552-a6c83a5ef1e20897
(broken) Transport work is merged in. Tests do not pass yet.

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
 
6
 
from bzrlib.selftest import InTempDir, TestCase
 
4
from bzrlib.selftest import TestCaseInTempDir, TestCase
7
5
from bzrlib.branch import ScratchBranch, Branch
8
6
from bzrlib.errors import NotBranchError, NotVersionedError
9
7
 
10
8
 
11
 
class TestBranch(InTempDir):
 
9
class TestBranch(TestCaseInTempDir):
12
10
 
13
11
    def test_unknowns(self):
14
12
        b = Branch('.', init=True)
72
70
                          'Martin Pool <mbp@sourcefrog.net>-20050311061123-96a255005c7c9dbe')
73
71
 
74
72
 
75
 
class PendingMerges(InTempDir):
 
73
class PendingMerges(TestCaseInTempDir):
 
74
 
76
75
    def test_pending_merges(self):
77
76
        """Tracking pending-merged revisions."""
78
77
        b = Branch('.', init=True)
79
78
 
80
79
        self.assertEquals(b.pending_merges(), [])
81
 
        
82
 
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
83
 
        
84
 
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
85
 
    
86
 
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
87
 
        
88
 
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
89
 
 
 
80
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
 
81
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
 
82
        b.add_pending_merge('foo@azkhazan-123123-abcabc')
 
83
        self.assertEquals(b.pending_merges(), ['foo@azkhazan-123123-abcabc'])
90
84
        b.add_pending_merge('wibble@fofof--20050401--1928390812')
91
85
        self.assertEquals(b.pending_merges(),
92
86
                          ['foo@azkhazan-123123-abcabc',
93
87
                           'wibble@fofof--20050401--1928390812'])
94
 
 
95
88
        b.commit("commit from base with two merges")
96
 
 
97
89
        rev = b.get_revision(b.revision_history()[0])
98
90
        self.assertEquals(len(rev.parents), 2)
99
91
        self.assertEquals(rev.parents[0].revision_id,
100
92
                          'foo@azkhazan-123123-abcabc')
101
93
        self.assertEquals(rev.parents[1].revision_id,
102
94
                           'wibble@fofof--20050401--1928390812')
103
 
 
104
95
        # list should be cleared when we do a commit
105
96
        self.assertEquals(b.pending_merges(), [])
106
97
        
218
209
        finally:
219
210
            os.chdir(savedir)
220
211
            shutil.rmtree(dtmp)
221
 
 
222
 
 
223
 
TEST_CLASSES = [TestBranch,
224
 
                TestRevisionId,
225
 
                PendingMerges
226
 
                ]