~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_switch.py

  • Committer: Rory Yorke
  • Date: 2010-10-20 14:38:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5519.
  • Revision ID: rory.yorke@gmail.com-20101020143853-9kfd2ldcjfroh8jw
Show missing files in bzr status (bug 134168).

"bzr status" will now show missing files, that is, those added with "bzr
add" and then removed by non bzr means (e.g., rm).

Blackbox tests were added for this case, and tests were also added to
test_delta, since the implementation change is in bzrlib.delta.

Might also affect bug 189709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2011 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
25
25
    merge as _mod_merge,
26
26
    switch,
27
27
    tests,
28
 
    )
 
28
)
29
29
 
30
30
 
31
31
class TestSwitch(tests.TestCaseWithTransport):
53
53
            lightweight=self.lightweight)
54
54
        self.build_tree(['checkout/file-3'])
55
55
        checkout.add('file-3')
56
 
        self.assertPathDoesNotExist('checkout/file-1')
57
 
        self.assertPathExists('checkout/file-2')
 
56
        self.failIfExists('checkout/file-1')
 
57
        self.failUnlessExists('checkout/file-2')
58
58
        switch.switch(checkout.bzrdir, to_branch)
59
 
        self.assertPathExists('checkout/file-1')
60
 
        self.assertPathDoesNotExist('checkout/file-2')
61
 
        self.assertPathExists('checkout/file-3')
 
59
        self.failUnlessExists('checkout/file-1')
 
60
        self.failIfExists('checkout/file-2')
 
61
        self.failUnlessExists('checkout/file-3')
62
62
 
63
63
    def test_switch_after_branch_moved(self):
64
64
        """Test switch after the branch is moved."""
84
84
                'Unable to connect to current master branch .*'
85
85
                'To switch anyway, use --force.')
86
86
        switch.switch(checkout.bzrdir, to_branch, force=True)
87
 
        self.assertPathDoesNotExist('checkout/file-1')
88
 
        self.assertPathExists('checkout/file-2')
89
 
        self.assertPathExists('checkout/file-3')
 
87
        self.failIfExists('checkout/file-1')
 
88
        self.failUnlessExists('checkout/file-2')
 
89
        self.failUnlessExists('checkout/file-3')
90
90
 
91
91
    def test_switch_when_pending_merges(self):
92
92
        """Test graceful failure if pending merges are outstanding."""
120
120
        checkout = tree.branch.create_checkout('checkout',
121
121
            lightweight=self.lightweight)
122
122
        switch.switch(checkout.bzrdir, tree.branch, revision_id="rev1")
123
 
        self.assertPathExists('checkout/file-1')
124
 
        self.assertPathDoesNotExist('checkout/file-2')
 
123
        self.failUnlessExists('checkout/file-1')
 
124
        self.failIfExists('checkout/file-2')
125
125
 
126
126
    def test_switch_changing_root_id(self):
127
127
        tree = self._setup_tree()
179
179
        self.assertContainsRe(str(err),
180
180
            'Cannot switch as local commits found in the checkout.')
181
181
        # Check all is ok when force is given
182
 
        self.assertPathDoesNotExist('checkout/file-1')
183
 
        self.assertPathExists('checkout/file-2')
 
182
        self.failIfExists('checkout/file-1')
 
183
        self.failUnlessExists('checkout/file-2')
184
184
        switch.switch(checkout.bzrdir, to_branch, force=True)
185
 
        self.assertPathExists('checkout/file-1')
186
 
        self.assertPathDoesNotExist('checkout/file-2')
187
 
        self.assertPathDoesNotExist('checkout/file-3')
188
 
        self.assertPathExists('checkout/file-4')
 
185
        self.failUnlessExists('checkout/file-1')
 
186
        self.failIfExists('checkout/file-2')
 
187
        self.failIfExists('checkout/file-3')
 
188
        self.failUnlessExists('checkout/file-4')
189
189
        # Check that the checkout is a true mirror of the bound branch
190
190
        self.assertEqual(to_branch.last_revision_info(),
191
191
                         checkout.branch.last_revision_info())