~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf_tests.py

  • Committer: Aaron Bentley
  • Date: 2006-02-21 05:08:07 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20060221050807-3cc86585e1ec6edc
Updated to match API changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
"""
27
27
    def test_shelf(self):
28
 
        from bzrlib.branch import Branch
29
 
        b = Branch.initialize('.')
 
28
        from bzrlib.bzrdir import BzrDir
 
29
        tree = BzrDir.create_standalone_workingtree('.')
30
30
 
31
31
        # Create a test file and commit it
32
32
        file('test_file', 'w').write(self.ORIGINAL)
33
 
        b.working_tree().add('test_file')
34
 
        b.working_tree().commit(message='add test_file')
 
33
        tree.add('test_file')
 
34
        tree.commit(message='add test_file')
35
35
 
36
36
        # Modify the test file
37
37
        file('test_file', 'w').write(self.MODIFIED)
65
65
 
66
66
    def test_shelf_nothing_to_shelve(self):
67
67
        import os.path
68
 
        from bzrlib.branch import Branch
69
 
        b = Branch.initialize('.')
 
68
        from bzrlib.bzrdir import BzrDir
 
69
        tree = BzrDir.create_standalone_workingtree('.')
70
70
 
71
71
        # Create a test file and commit it
72
72
        file('test_file', 'w').write(self.ORIGINAL)
73
 
        b.working_tree().add('test_file')
74
 
        b.working_tree().commit(message='add test_file')
 
73
        tree.add('test_file')
 
74
        tree.commit(message='add test_file')
75
75
 
76
76
        # Shelve the changes
77
77
        self.run_bzr('shelve', '--all')
80
80
            self.fail("Shelf exists, but it shouldn't")
81
81
 
82
82
    def test_shelf_with_revision(self):
83
 
        from bzrlib.branch import Branch
84
 
        b = Branch.initialize('.')
 
83
        from bzrlib.bzrdir import BzrDir
 
84
        tree = BzrDir.create_standalone_workingtree('.')
85
85
 
86
86
        # Create a test file and commit it
87
87
        file('test_file', 'w').write(self.ORIGINAL)
88
 
        b.working_tree().add('test_file')
89
 
        b.working_tree().commit(message='add test_file')
 
88
        tree.add('test_file')
 
89
        tree.commit(message='add test_file')
90
90
 
91
91
        # Modify the test file and commit it
92
92
        file('test_file', 'w').write(self.MODIFIED)
93
 
        b.working_tree().commit(message='update test_file')
 
93
        tree.commit(message='update test_file')
94
94
 
95
95
        # Shelve the changes
96
96
        self.run_bzr('shelve', '-r', '1', '--all', retcode=1)
109
109
        self.assertEqual(file('test_file').read(), self.MODIFIED)
110
110
 
111
111
    def test_shelf_with_two_revisions(self):
112
 
        from bzrlib.branch import Branch
113
 
        b = Branch.initialize('.')
 
112
        from bzrlib.bzrdir import BzrDir
 
113
        tree = BzrDir.create_standalone_workingtree('.')
114
114
 
115
115
        cmd = 'shelve -r 1..2'
116
116
        (stdout, stderr) = self.run_bzr_captured(cmd.split(), retcode=None)