~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_missing.py

  • Committer: Wouter van Heyst
  • Date: 2005-12-11 22:05:21 UTC
  • mto: (1185.54.20 bzr.missing)
  • mto: This revision was merged to the branch mainline in revision 1525.
  • Revision ID: larstiq@larstiq.dyndns.org-20051211220521-094e867abca7417c
Add testcase for missing command, improved with feedback from Robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Black-box tests for bzr missing.
 
2
"""
 
3
 
 
4
import os
 
5
 
 
6
from bzrlib.branch import Branch
 
7
from bzrlib.tests import TestCaseInTempDir
 
8
 
 
9
class TestMissing(TestCaseInTempDir):
 
10
    def test_missing(self):
 
11
        missing = "You are missing the following revisions:"
 
12
 
 
13
        # create a source branch
 
14
        os.mkdir('a')
 
15
        os.chdir('a')
 
16
        self.capture('init')
 
17
        open('a', 'wb').write('initial\n')
 
18
        self.capture('add a')
 
19
        self.capture('commit -m inital')
 
20
 
 
21
        # clone and add a differing revision
 
22
        self.capture('branch . ../b')
 
23
        os.chdir('../b')
 
24
        open('a', 'ab').write('more\n')
 
25
        self.capture('commit -m more')
 
26
 
 
27
        # compare a against b
 
28
        os.chdir('../a')
 
29
        lines = self.capture('missing ../b').splitlines()
 
30
        # we're missing the extra revision here
 
31
        self.assertEqual(missing, lines[0])
 
32
        self.assertEqual(8, len(lines))
 
33
 
 
34
        # get extra revision from b
 
35
        self.capture('merge ../b')
 
36
        self.capture('commit -m merge')
 
37
 
 
38
        # compare again, but now we have the 'merge' commit extra
 
39
        lines = self.capture('missing ../b').splitlines()
 
40
        self.assertEqual("You have the following extra revisions:", lines[0])
 
41
        self.assertEqual(8, len(lines))
 
42
 
 
43
        # relative to a, missing the 'merge' commit 
 
44
        os.chdir('../b')
 
45
        lines = self.capture('missing ../a').splitlines()
 
46
        self.assertEqual(missing, lines[0])
 
47
        self.assertEqual(8, len(lines))
 
48
        
 
49
        # after a pull we're back on track
 
50
        self.capture('pull')
 
51
        self.assertEqual("Branches are up to date.\n", self.capture('missing ../a'))
 
52