~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005, 2009 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
16
#
 
17
 
 
18
 
 
19
"""Tests of the 'bzr clean-tree' command."""
 
20
 
 
21
 
 
22
import os
 
23
 
 
24
from bzrlib.tests import TestCaseWithTransport
 
25
 
 
26
 
 
27
class TestBzrTools(TestCaseWithTransport):
 
28
 
 
29
    @staticmethod
 
30
    def touch(filename):
 
31
        my_file = open(filename, 'wb')
 
32
        try:
 
33
            my_file.write('')
 
34
        finally:
 
35
            my_file.close()
 
36
 
 
37
    def test_clean_tree(self):
 
38
        self.run_bzr('init')
 
39
        self.run_bzr('ignore *~')
 
40
        self.run_bzr('ignore *.pyc')
 
41
        self.touch('name')
 
42
        self.touch('name~')
 
43
        self.failUnlessExists('name~')
 
44
        self.touch('name.pyc')
 
45
        self.run_bzr('clean-tree --force')
 
46
        self.failUnlessExists('name~')
 
47
        self.failIfExists('name')
 
48
        self.touch('name')
 
49
        self.run_bzr('clean-tree --detritus --force')
 
50
        self.failUnlessExists('name')
 
51
        self.failIfExists('name~')
 
52
        self.failUnlessExists('name.pyc')
 
53
        self.run_bzr('clean-tree --ignored --force')
 
54
        self.failUnlessExists('name')
 
55
        self.failIfExists('name.pyc')
 
56
        self.run_bzr('clean-tree --unknown --force')
 
57
        self.failIfExists('name')
 
58
        self.touch('name')
 
59
        self.touch('name~')
 
60
        self.touch('name.pyc')
 
61
        self.run_bzr('clean-tree --unknown --ignored --force')
 
62
        self.failIfExists('name')
 
63
        self.failIfExists('name~')
 
64
        self.failIfExists('name.pyc')