~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests.py

  • Committer: Michael Ellerman
  • Date: 2005-10-26 09:48:16 UTC
  • mto: (0.3.1 shelf-dev) (325.1.2 bzrtools)
  • mto: This revision was merged to the branch mainline in revision 246.
  • Revision ID: michael@ellerman.id.au-20051026094816-8441fb21a9fefce1
Add (failing) tests of revision argument for shelve.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
 
70
70
        if os.path.exists('.bzr-shelf'):
71
71
            self.fail("Shelf exists, but it shouldn't")
 
72
 
 
73
    def test_shelf_with_revision(self):
 
74
        from bzrlib.branch import Branch
 
75
        b = Branch.initialize('.')
 
76
 
 
77
        # Create a test file and commit it
 
78
        file('test_file', 'w').write(self.ORIGINAL)
 
79
        b.add('test_file')
 
80
        b.commit(message='add test_file')
 
81
 
 
82
        # Modify the test file and commit it
 
83
        file('test_file', 'w').write(self.MODIFIED)
 
84
        b.commit(message='update test_file')
 
85
 
 
86
        # Shelve the changes
 
87
        self.run_bzr('shelve', '-r', '1', '--all', retcode=True)
 
88
 
 
89
    def test_shelf_with_two_revisions(self):
 
90
        from bzrlib.branch import Branch
 
91
        b = Branch.initialize('.')
 
92
 
 
93
        cmd = 'shelve -r 1..2'
 
94
        (stdout, stderr) = self.run_bzr_captured(cmd.split(), retcode=None)
 
95
 
 
96
        self.assertEqual(stderr.split('\n')[0],
 
97
            'bzr: ERROR: shelve only accepts a single revision parameter.')