~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf_tests.py

Move add from Branch to WorkingTree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
"""
27
27
    def test_shelf(self):
28
28
        from bzrlib.branch import Branch
 
29
        from bzrlib.workingtree import WorkingTree
29
30
        b = Branch.initialize('.')
 
31
        tree = WorkingTree(b.base, b)
30
32
 
31
33
        # Create a test file and commit it
32
34
        file('test_file', 'w').write(self.ORIGINAL)
33
 
        b.add('test_file')
34
 
        b.working_tree().commit(message='add test_file')
 
35
        tree.add('test_file')
 
36
        tree.commit(message='add test_file')
35
37
 
36
38
        # Modify the test file
37
39
        file('test_file', 'w').write(self.MODIFIED)
66
68
    def test_shelf_nothing_to_shelve(self):
67
69
        import os.path
68
70
        from bzrlib.branch import Branch
 
71
        from bzrlib.workingtree import WorkingTree
69
72
        b = Branch.initialize('.')
 
73
        tree = WorkingTree(b.base, b)
70
74
 
71
75
        # Create a test file and commit it
72
76
        file('test_file', 'w').write(self.ORIGINAL)
73
 
        b.add('test_file')
74
 
        b.working_tree().commit(message='add test_file')
 
77
        tree.add('test_file')
 
78
        tree.commit(message='add test_file')
75
79
 
76
80
        # Shelve the changes
77
81
        self.run_bzr('shelve', '--all', retcode=True)
81
85
 
82
86
    def test_shelf_with_revision(self):
83
87
        from bzrlib.branch import Branch
 
88
        from bzrlib.workingtree import WorkingTree
84
89
        b = Branch.initialize('.')
 
90
        tree = WorkingTree(b.base, b)
85
91
 
86
92
        # Create a test file and commit it
87
93
        file('test_file', 'w').write(self.ORIGINAL)
88
 
        b.add('test_file')
89
 
        b.working_tree().commit(message='add test_file')
 
94
        tree.add('test_file')
 
95
        tree.commit(message='add test_file')
90
96
 
91
97
        # Modify the test file and commit it
92
98
        file('test_file', 'w').write(self.MODIFIED)
93
 
        b.working_tree().commit(message='update test_file')
 
99
        tree.commit(message='update test_file')
94
100
 
95
101
        # Shelve the changes
96
102
        self.run_bzr('shelve', '-r', '1', '--all', retcode=True)