~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Robert Collins
  • Date: 2005-09-12 12:28:19 UTC
  • mfrom: (1185.3.4)
  • mto: (1092.3.2)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050912122819-e3f141d4a14f3f7f
mergeĀ fromĀ HEAD

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
import os;
30
30
import sys
 
31
import os
31
32
 
32
33
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
33
34
from bzrlib.branch import Branch
123
124
        assert file('.bzrignore', 'rb').read() == '*.blah\ngarh\n'
124
125
 
125
126
    def test_revert(self):
126
 
        import os
127
127
        self.runbzr('init')
128
128
 
129
129
        file('hello', 'wt').write('foo')
195
195
 
196
196
    def test_merge(self):
197
197
        from bzrlib.branch import Branch
198
 
        import os
199
198
        
200
199
        os.mkdir('a')
201
200
        os.chdir('a')
217
216
        a = Branch('.')
218
217
        b = Branch('../b')
219
218
        a.get_revision_xml(b.last_patch())
220
 
        print "Pending: %s" % a.pending_merges()
221
 
#        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
222
 
#        % (a.pending_merges(), b.last_patch())
 
219
        self.log('pending merges: %s', a.pending_merges())
 
220
        #        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
 
221
        #        % (a.pending_merges(), b.last_patch())
 
222
 
 
223
    def test_pull(self):
 
224
        """Pull changes from one branch to another."""
 
225
        os.mkdir('a')
 
226
        os.chdir('a')
 
227
 
 
228
        self.example_branch()
 
229
        os.chdir('..')
 
230
        self.runbzr('branch a b')
 
231
        os.chdir('b')
 
232
        self.runbzr('commit -m blah --unchanged')
 
233
        os.chdir('../a')
 
234
        a = Branch('.')
 
235
        b = Branch('../b')
 
236
        assert a.revision_history() == b.revision_history()[:-1]
 
237
        self.runbzr('pull ../b')
 
238
        assert a.revision_history() == b.revision_history()
 
239
        self.runbzr('commit -m blah2 --unchanged')
 
240
        os.chdir('../b')
 
241
        self.runbzr('commit -m blah3 --unchanged')
 
242
        self.runbzr('pull ../a', retcode=1)
 
243
        os.chdir('../a')
 
244
        self.runbzr('merge ../b')
 
245
        self.runbzr('commit -m blah4 --unchanged')
 
246
        os.chdir('../b')
 
247
        self.runbzr('pull ../a')
 
248
        assert a.revision_history()[-1] == b.revision_history()[-1]
 
249
        
 
250
 
 
251
    def test_add_reports(self):
 
252
        """add command prints the names of added files."""
 
253
        b = Branch('.', init=True)
 
254
        self.build_tree(['top.txt', 'dir/', 'dir/sub.txt'])
 
255
 
 
256
        from cStringIO import StringIO
 
257
        out = StringIO()
 
258
 
 
259
        ret = self.apply_redirected(None, out, None,
 
260
                                    run_bzr,
 
261
                                    ['add'])
 
262
        self.assertEquals(ret, 0)
 
263
 
 
264
        # the ordering is not defined at the moment
 
265
        results = sorted(out.getvalue().rstrip('\n').split('\n'))
 
266
        self.assertEquals(['added dir',
 
267
                           'added dir/sub.txt',
 
268
                           'added top.txt',],
 
269
                          results)
223
270
 
224
271
 
225
272
def has_symlinks():
233
280
    L.sort()
234
281
    return L
235
282
 
 
283
 
236
284
class OldTests(ExternalBase):
237
285
    """old tests moved from ./testbzr."""
238
286