~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

  • Committer: Robert Collins
  • Date: 2005-08-25 06:14:17 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050825061417-3c01eb11acb37ff0
merge from mpool up to rev 1110

Show diffs side-by-side

added added

removed removed

Lines of Context:
347
347
        runbzr('log --forward')
348
348
 
349
349
        runbzr('info')
 
350
 
 
351
 
 
352
 
 
353
def example_branch(test):
 
354
    test.runbzr('init')
 
355
 
 
356
    file('hello', 'wt').write('foo')
 
357
    test.runbzr('add hello')
 
358
    test.runbzr('commit -m setup hello')
 
359
 
 
360
    file('goodbye', 'wt').write('baz')
 
361
    test.runbzr('add goodbye')
 
362
    test.runbzr('commit -m setup goodbye')
 
363
 
 
364
 
 
365
class RevertCommand(ExternalBase):
 
366
    def runTest(self):
 
367
        example_branch(self)
 
368
        file('hello', 'wt').write('bar')
 
369
        file('goodbye', 'wt').write('qux')
 
370
        self.runbzr('revert hello')
 
371
        self.check_file_contents('hello', 'foo')
 
372
        self.check_file_contents('goodbye', 'qux')
 
373
        self.runbzr('revert')
 
374
        self.check_file_contents('goodbye', 'baz')
 
375
 
 
376
 
 
377
class MergeCommand(ExternalBase):
 
378
    def runTest(self):
 
379
        from bzrlib.branch import Branch
 
380
        import os
 
381
        os.mkdir('a')
 
382
        os.chdir('a')
 
383
        example_branch(self)
 
384
        os.chdir('..')
 
385
        self.runbzr('branch a b')
 
386
        os.chdir('b')
 
387
        file('goodbye', 'wt').write('quux')
 
388
        self.runbzr(['commit',  '-m',  "more u's are always good"])
 
389
 
 
390
        os.chdir('../a')
 
391
        file('hello', 'wt').write('quuux')
 
392
        # We can't merge when there are in-tree changes
 
393
        self.runbzr('merge ../b', retcode=1)
 
394
        self.runbzr(['commit', '-m', "Like an epidemic of u's"])
 
395
        self.runbzr('merge ../b')
 
396
        self.check_file_contents('goodbye', 'quux')
 
397
        # Merging a branch pulls its revision into the tree
 
398
        a = Branch('.')
 
399
        b = Branch('../b')
 
400
        a.get_revision_xml(b.last_patch())
 
401
        print "Pending: %s" % a.pending_merges()
 
402
#        assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
 
403
#        % (a.pending_merges(), b.last_patch())
 
404