~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: 2006-07-01 18:46:16 UTC
  • mfrom: (1551.7.9 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20060701184616-b0b6979d6f86a5a1
bzr revert DIRNAME works recursively

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import bzrlib.osutils
22
22
from bzrlib.tests.blackbox import ExternalBase
23
23
from bzrlib.trace import mutter
 
24
from bzrlib.workingtree import WorkingTree
24
25
 
25
26
 
26
27
class TestRevert(ExternalBase):
44
45
        # check status
45
46
        self.assertEquals('modified:\n  dir/file\n', self.capture('status'))
46
47
 
 
48
    def _prepare_rename_mod_tree(self):
 
49
        self.build_tree(['a/', 'a/b', 'a/c', 'a/d/', 'a/d/e', 'f/', 'f/g', 
 
50
                         'f/h', 'f/i'])
 
51
        self.run_bzr('init')
 
52
        self.run_bzr('add')
 
53
        self.run_bzr('commit', '-m', '1')
 
54
        wt = WorkingTree.open('.')
 
55
        wt.rename_one('a/b', 'f/b')
 
56
        wt.rename_one('a/d/e', 'f/e')
 
57
        wt.rename_one('a/d', 'f/d')
 
58
        wt.rename_one('f/g', 'a/g')
 
59
        wt.rename_one('f/h', 'h')
 
60
        wt.rename_one('f', 'j')
 
61
 
47
62
    def helper(self, param=''):
48
63
        self._prepare_tree()
49
64
        # change dir
74
89
        self.runbzr('revert')
75
90
        self.assertEqual('', self.capture('status'))
76
91
 
 
92
    def test_revert_dirname(self):
 
93
        """Test that revert DIRECTORY does what's expected"""
 
94
        self._prepare_rename_mod_tree()
 
95
        self.run_bzr('revert', 'a')
 
96
        self.failUnlessExists('a/b')
 
97
        self.failUnlessExists('a/d')
 
98
        self.failIfExists('a/g')
 
99
        self.failUnlessExists('j')
 
100
        self.failUnlessExists('h')
 
101
        self.run_bzr('revert', 'f')
 
102
        self.failIfExists('j')
 
103
        self.failIfExists('h')
 
104
        self.failUnlessExists('a/d/e')
 
105
 
77
106
    def test_revert(self):
78
107
        self.run_bzr('init')
79
108