~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009-2012 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009-2012, 2016 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
52
52
        out = self.run_bzr('add')[0]
53
53
        # the ordering is not defined at the moment
54
54
        results = sorted(out.rstrip('\n').split('\n'))
55
 
        self.assertEquals(['adding .bzrignore',
 
55
        self.assertEqual(['adding .bzrignore',
56
56
                           'adding dir',
57
57
                           'adding dir/sub.txt',
58
58
                           'adding top.txt'],
59
59
                          results)
60
60
        out = self.run_bzr('add -v')[0]
61
61
        results = sorted(out.rstrip('\n').split('\n'))
62
 
        self.assertEquals(['ignored CVS matching "CVS"'],
 
62
        self.assertEqual(['ignored CVS matching "CVS"'],
63
63
                          results)
64
64
 
65
65
    def test_add_quiet_is(self):
69
69
        out = self.run_bzr('add -q')[0]
70
70
        # the ordering is not defined at the moment
71
71
        results = sorted(out.rstrip('\n').split('\n'))
72
 
        self.assertEquals([''], results)
 
72
        self.assertEqual([''], results)
73
73
 
74
74
    def test_add_in_unversioned(self):
75
75
        """Try to add a file in an unversioned directory.
78
78
        """
79
79
        tree = self.make_branch_and_tree('.')
80
80
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
81
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n')
 
81
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
82
82
        self.run_bzr('add inertiatic/esp')
83
 
        self.assertEquals(self.run_bzr('unknowns')[0], '')
 
83
        self.assertEqual(self.run_bzr('unknowns')[0], '')
84
84
 
85
85
        # Multiple unversioned parents
86
86
        self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt'])
87
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'veil\n')
 
87
        self.assertEqual(self.run_bzr('unknowns')[0], 'veil\n')
88
88
        self.run_bzr('add veil/cerpin/taxt')
89
 
        self.assertEquals(self.run_bzr('unknowns')[0], '')
 
89
        self.assertEqual(self.run_bzr('unknowns')[0], '')
90
90
 
91
91
        # Check whacky paths work
92
92
        self.build_tree(['cicatriz/', 'cicatriz/esp'])
93
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'cicatriz\n')
 
93
        self.assertEqual(self.run_bzr('unknowns')[0], 'cicatriz\n')
94
94
        self.run_bzr('add inertiatic/../cicatriz/esp')
95
 
        self.assertEquals(self.run_bzr('unknowns')[0], '')
 
95
        self.assertEqual(self.run_bzr('unknowns')[0], '')
96
96
 
97
97
    def test_add_no_recurse(self):
98
98
        tree = self.make_branch_and_tree('.')
99
99
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
100
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n')
 
100
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
101
101
        self.run_bzr('add -N inertiatic')
102
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
 
102
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
103
103
 
104
104
    def test_add_in_versioned(self):
105
105
        """Try to add a file in a versioned directory.
108
108
        """
109
109
        tree = self.make_branch_and_tree('.')
110
110
        self.build_tree(['inertiatic/', 'inertiatic/esp'])
111
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic\n')
 
111
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic\n')
112
112
        self.run_bzr('add --no-recurse inertiatic')
113
 
        self.assertEquals(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
 
113
        self.assertEqual(self.run_bzr('unknowns')[0], 'inertiatic/esp\n')
114
114
        self.run_bzr('add inertiatic/esp')
115
 
        self.assertEquals(self.run_bzr('unknowns')[0], '')
 
115
        self.assertEqual(self.run_bzr('unknowns')[0], '')
116
116
 
117
117
    def test_subdir_add(self):
118
118
        """Add in subdirectory should add only things from there down"""
133
133
        # add with no arguments in a subdirectory gets only files below that
134
134
        # subdirectory
135
135
        self.run_bzr('add', working_dir='src')
136
 
        self.assertEquals('README\n',
 
136
        self.assertEqual('README\n',
137
137
                          self.run_bzr('unknowns', working_dir='src')[0])
138
138
        # reopen to see the new changes
139
139
        t = t.bzrdir.open_workingtree('src')
140
140
        versioned = [path for path, entry in t.iter_entries_by_dir()]
141
 
        self.assertEquals(versioned, ['', 'src', 'src/foo.c'])
 
141
        self.assertEqual(versioned, ['', 'src', 'src/foo.c'])
142
142
 
143
143
        # add from the parent directory should pick up all file names
144
144
        self.run_bzr('add')
145
 
        self.assertEquals(self.run_bzr('unknowns')[0], '')
 
145
        self.assertEqual(self.run_bzr('unknowns')[0], '')
146
146
        self.run_bzr('check')
147
147
 
148
148
    def test_add_missing(self):
216
216
        self.build_tree(['source/top.txt'])
217
217
        os.symlink('source', 'link')
218
218
        out = self.run_bzr(['add', 'link/top.txt'])[0]
219
 
        self.assertEquals(out, 'adding top.txt\n')
 
219
        self.assertEqual(out, 'adding top.txt\n')
220
220
 
221
221
    def test_add_symlink_to_abspath(self):
222
222
        self.requireFeature(features.SymlinkFeature)
223
223
        self.make_branch_and_tree('tree')
224
224
        os.symlink(osutils.abspath('target'), 'tree/link')
225
225
        out = self.run_bzr(['add', 'tree/link'])[0]
226
 
        self.assertEquals(out, 'adding link\n')
 
226
        self.assertEqual(out, 'adding link\n')
227
227
 
228
228
    def test_add_not_child(self):
229
229
        # https://bugs.launchpad.net/bzr/+bug/98735
242
242
        self.make_branch_and_tree(u"\xA7")
243
243
        self.build_tree([u"\xA7/a", u"\xA7/b"])
244
244
        out, err = self.run_bzr(["add", "a", "b"], working_dir=u"\xA7")
245
 
        self.assertEquals(out, "adding a\n" "adding b\n")
246
 
        self.assertEquals(err, "")
 
245
        self.assertEqual(out, "adding a\n" "adding b\n")
 
246
        self.assertEqual(err, "")
247
247
 
248
248
    def test_add_skip_large_files(self):
249
249
        """Test skipping files larger than add.maximum_file_size"""
255
255
        tree.branch.get_config_stack().set('add.maximum_file_size', 5)
256
256
        out = self.run_bzr('add')[0]
257
257
        results = sorted(out.rstrip('\n').split('\n'))
258
 
        self.assertEquals(['adding small.txt'], results)
 
258
        self.assertEqual(['adding small.txt'], results)
259
259
        # named items never skipped, even if over max
260
260
        out, err = self.run_bzr(["add", "big2.txt"])
261
261
        results = sorted(out.rstrip('\n').split('\n'))
262
 
        self.assertEquals(['adding big2.txt'], results)
263
 
        self.assertEquals("", err)
 
262
        self.assertEqual(['adding big2.txt'], results)
 
263
        self.assertEqual("", err)
264
264
        tree.branch.get_config_stack().set('add.maximum_file_size', 30)
265
265
        out = self.run_bzr('add')[0]
266
266
        results = sorted(out.rstrip('\n').split('\n'))
267
 
        self.assertEquals(['adding big.txt'], results)
 
267
        self.assertEqual(['adding big.txt'], results)