~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/versioning.py

  • Committer: Martin Pool
  • Date: 2005-08-24 08:59:32 UTC
  • Revision ID: mbp@sourcefrog.net-20050824085932-c61f1f1f1c930e13
- Add a simple UIFactory 

  The idea of this is to let a client of bzrlib set some 
  policy about how output is displayed.

  In this revision all that's done is that progress bars
  are constructed by a policy established by the application
  rather than being randomly constructed in the library 
  or passed down the calls.  This avoids progress bars
  popping up while running the test suite and cleans up
  some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.branch import Branch
27
27
 
28
28
 
29
 
class Mkdir(InTempDir):
30
 
    def runTest(self): 
 
29
class TestVersioning(InTempDir):
 
30
    
 
31
    def test_mkdir(self): 
31
32
        """Basic 'bzr mkdir' operation"""
32
33
        from bzrlib.commands import run_bzr
33
34
 
49
50
        self.assertEquals(delta.added[0][0], 'foo')
50
51
        self.failIf(delta.modified)
51
52
 
52
 
 
53
 
 
54
 
class AddInUnversioned(InTempDir):
55
 
    def runTest(self):
 
53
    def test_add_in_unversioned(self):
56
54
        """Try to add a file in an unversioned directory.
57
55
 
58
56
        smart_add may eventually add the parent as necessary, but simple
70
68
                          b.add,
71
69
                          'foo/hello')
72
70
        
 
71
    def test_subdir_add(self):
 
72
        """Add in subdirectory should add only things from there down"""
 
73
        
 
74
        from bzrlib.branch import Branch
 
75
        from bzrlib.commands import run_bzr
 
76
        
 
77
        eq = self.assertEqual
 
78
        ass = self.assert_
 
79
        chdir = os.chdir
 
80
        
 
81
        b = Branch('.', init=True)
 
82
        self.build_tree(['src/', 'README'])
 
83
        
 
84
        eq(sorted(b.unknowns()),
 
85
           ['README', 'src'])
 
86
        
 
87
        eq(run_bzr(['add', 'src']), 0)
 
88
        
 
89
        self.build_tree(['src/foo.c'])
 
90
        
 
91
        chdir('src')
 
92
        eq(run_bzr(['add']), 0)
 
93
        
 
94
        eq(sorted(b.unknowns()), 
 
95
           ['README'])
 
96
        eq(len(b.inventory), 3)
 
97
                
 
98
        chdir('..')
 
99
        eq(run_bzr(['add']), 0)
 
100
        eq(list(b.unknowns()), [])
 
101
        
73
102
        
74
103
class SubdirCommit(BzrTestBase):
75
 
    def runTest(self):
 
104
 
 
105
    def test_subdir_commit(self):
76
106
        """Test committing a subdirectory, and committing within a directory."""
77
107
        run_bzr = self.run_bzr
78
108
        eq = self.assertEqual
116
146
        
117
147
        # TODO: factor out some kind of assert_tree_state() method
118
148
        
119
 
        
120
 
        
121
 
class SubdirAdd(InTempDir):
122
 
    def runTest(self):
123
 
        """Add in subdirectory should add only things from there down"""
124
 
        
125
 
        from bzrlib.branch import Branch
126
 
        from bzrlib.commands import run_bzr
127
 
        
128
 
        eq = self.assertEqual
129
 
        ass = self.assert_
130
 
        chdir = os.chdir
131
 
        
132
 
        b = Branch('.', init=True)
133
 
        self.build_tree(['src/', 'README'])
134
 
        
135
 
        eq(sorted(b.unknowns()),
136
 
           ['README', 'src'])
137
 
        
138
 
        eq(run_bzr(['add', 'src']), 0)
139
 
        
140
 
        self.build_tree(['src/foo.c'])
141
 
        
142
 
        chdir('src')
143
 
        eq(run_bzr(['add']), 0)
144
 
        
145
 
        eq(sorted(b.unknowns()), 
146
 
           ['README'])
147
 
        eq(len(b.inventory), 3)
148
 
                
149
 
        chdir('..')
150
 
        eq(run_bzr(['add']), 0)
151
 
        eq(list(b.unknowns()), [])
152