~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-27 20:05:11 UTC
  • mfrom: (1711.2.100 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060727200511-3bfb6377b1695fad
(Matthieu Moy) handle 'bzr diff' when not in a branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
                                url, retcode=3)
42
42
        self.assertEqual(u'bzr: ERROR: Not a branch:'
43
43
                         u' %s\n' % url, err)
 
44
 
 
45
    def test_diff_ouside_tree(self):
 
46
        os.chdir(tempfile.mkdtemp())
 
47
        self.run_bzr_captured(['init', 'branch1'])
 
48
        self.run_bzr_captured(['commit', '-m', 'nothing', 
 
49
                               '--unchanged', 'branch1'])
 
50
        self.run_bzr_captured(['commit', '-m', 'nothing', 
 
51
                               '--unchanged', 'branch1'])
 
52
        # -r X..Y
 
53
        out, err = self.run_bzr_captured(['diff', 
 
54
                                          '-r', 'revno:2:branch2..revno:1'],
 
55
                                         retcode=3)
 
56
        self.assertEquals('', out)
 
57
        self.assertEqual(u'bzr: ERROR: Not a branch: %s/\n' % (getcwd(),),
 
58
                         err)
 
59
        # -r X
 
60
        out, err = self.run_bzr_captured(['diff', '-r', 'revno:2:branch2'],
 
61
                                         retcode=3)
 
62
        self.assertEquals('', out)
 
63
        self.assertEqual(u'bzr: ERROR: Not a branch: %s/\n' % (getcwd(),),
 
64
                         err)
 
65
        # -r X..
 
66
        out, err = self.run_bzr_captured(['diff', '-r', 'revno:2:branch2..'],
 
67
                                         retcode=3)
 
68
        self.assertEquals('', out)
 
69
        self.assertEqual(u'bzr: ERROR: Not a branch: %s/\n' % (getcwd(),),
 
70
                         err)
 
71
        # no -r at all.
 
72
        out, err = self.run_bzr_captured(['diff'],
 
73
                                         retcode=3)
 
74
        self.assertEquals('', out)
 
75
        self.assertEqual(u'bzr: ERROR: Not a branch: %s/\n' % (getcwd(),),
 
76
                         err)
 
77
        
 
78