~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-07 10:45:44 UTC
  • mfrom: (2321.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070307104544-59e3e6358e4bdb29
(robertc) Merge dirstate and subtrees. (Robert Collins, Martin Pool, Aaaron Bentley, John A Meinel, James Westby)

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
    def test_revert_chatter(self):
107
107
        self._prepare_rename_mod_tree()
108
108
        chatter = self.run_bzr('revert')[1]
109
 
        self.assertEqualDiff('R   j/b => a/b\n'
110
 
                             'R   j/d/ => a/d/\n'
111
 
                             'R   j/e => a/d/e\n'
112
 
                             'R   j/ => f/\n'
113
 
                             'R   a/g => f/g\n'
114
 
                             'R   h => f/h\n', chatter)
 
109
        self.assertEqualDiff(
 
110
            'R   a/g => f/g\n'
 
111
            'R   h => f/h\n'
 
112
            'R   j/ => f/\n'
 
113
            'R   j/b => a/b\n'
 
114
            'R   j/d/ => a/d/\n'
 
115
            'R   j/e => a/d/e\n',
 
116
            chatter)
 
117
 
115
118
    def test_revert(self):
116
119
        self.run_bzr('init')
117
120
 
161
164
        os.chdir('revertdir')
162
165
        self.run_bzr('revert')
163
166
        os.chdir('..')
 
167
 
 
168
    def test_revert_newly_added(self):
 
169
        # this tests the UI reports reverting a newly added file
 
170
        # correct (such files are not deleted)
 
171
        tree = self.make_branch_and_tree('.')
 
172
        self.build_tree(['file'])
 
173
        tree.add(['file'])
 
174
        out, err = self.run_bzr('revert')
 
175
        self.assertEqual('', out)
 
176
        self.assertEqual('-   file\n', err)
 
177
 
 
178
    def test_revert_removing_file(self):
 
179
        # this tests the UI reports reverting a file which has been committed
 
180
        # to a revision that did not have it, reports it as being deleted.
 
181
        tree = self.make_branch_and_tree('.')
 
182
        tree.commit('empty commit')
 
183
        self.build_tree(['file'])
 
184
        tree.add(['file'])
 
185
        tree.commit('add file')
 
186
        out, err = self.run_bzr('revert', '-r', '-2')
 
187
        self.assertEqual('', out)
 
188
        self.assertEqual('-D  file\n', err)