~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009-2012 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
154
154
        new_tree = self.make_branch_and_tree('new')
155
155
        self.build_tree(['new/a', 'new/b/', 'new/b/c', 'd'])
156
156
 
157
 
        os.chdir('new')
158
 
        out, err = self.run_bzr('add --file-ids-from ../base')
 
157
        out, err = self.run_bzr('add --file-ids-from ../base',
 
158
                                working_dir='new')
159
159
        self.assertEqual('', err)
160
160
        self.assertEqualDiff('adding a w/ file id from a\n'
161
161
                             'adding b w/ file id from b\n'
175
175
        new_tree = self.make_branch_and_tree('new')
176
176
        self.build_tree(['new/c', 'new/d'])
177
177
 
178
 
        os.chdir('new')
179
 
        out, err = self.run_bzr('add --file-ids-from ../base/b')
 
178
        out, err = self.run_bzr('add --file-ids-from ../base/b',
 
179
                                working_dir='new')
180
180
        self.assertEqual('', err)
181
181
        self.assertEqualDiff('adding c w/ file id from b/c\n'
182
182
                             'adding d w/ file id from b/d\n',
183
183
                             out)
184
184
 
185
 
        new_tree = new_tree.bzrdir.open_workingtree()
 
185
        new_tree = new_tree.bzrdir.open_workingtree('new')
186
186
        self.assertEqual(base_tree.path2id('b/c'), new_tree.path2id('c'))
187
187
        self.assertEqual(base_tree.path2id('b/d'), new_tree.path2id('d'))
188
188
 
239
239
        out, err = self.run_bzr(["add", "a", "b"], working_dir=u"\xA7")
240
240
        self.assertEquals(out, "adding a\n" "adding b\n")
241
241
        self.assertEquals(err, "")
242
 
        
 
242
 
243
243
    def test_add_skip_large_files(self):
244
244
        """Test skipping files larger than add.maximum_file_size"""
245
245
        tree = self.make_branch_and_tree('.')
250
250
        tree.branch.get_config().set_user_option('add.maximum_file_size', 5)
251
251
        out = self.run_bzr('add')[0]
252
252
        results = sorted(out.rstrip('\n').split('\n'))
253
 
        self.assertEquals(['adding small.txt'], 
254
 
                          results)
 
253
        self.assertEquals(['adding small.txt'], results)
255
254
        # named items never skipped, even if over max
256
255
        out, err = self.run_bzr(["add", "big2.txt"])
257
256
        results = sorted(out.rstrip('\n').split('\n'))
258
 
        self.assertEquals(['adding big2.txt'], 
259
 
                          results)
260
 
        self.assertEquals(err, "")
261
 
        tree.branch.get_config().set_user_option('add.maximum_file_size', 30)
 
257
        self.assertEquals(['adding big2.txt'], results)
 
258
        self.assertEquals("", err)
 
259
        tree.branch.get_config_stack().set('add.maximum_file_size', 30)
262
260
        out = self.run_bzr('add')[0]
263
261
        results = sorted(out.rstrip('\n').split('\n'))
264
 
        self.assertEquals(['adding big.txt'], 
265
 
                          results)
 
262
        self.assertEquals(['adding big.txt'], results)