~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2008-07-11 21:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080711214124-qi09irlj7pd5cuzg
Shortcut the case when one revision is in the ancestry of the other.

At the cost of a heads() check, when one parent supersedes, we don't have to extract
the text for the other. Changes merge time from 3m37s => 3m21s. Using a
CachingParentsProvider would drop the time down to 3m11s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
        results = sorted(out.rstrip('\n').split('\n'))
36
36
        self.assertEquals(['If you wish to add some of these files, please'\
37
37
                           ' add them by name.',
38
 
                           'add completed',
39
 
                           'adding .bzrignore',
40
 
                           'adding dir',
41
 
                           'adding dir/sub.txt',
42
 
                           'adding top.txt',
 
38
                           'added .bzrignore',
 
39
                           'added dir',
 
40
                           'added dir/sub.txt',
 
41
                           'added top.txt',
43
42
                           'ignored 1 file(s).'],
44
43
                          results)
45
44
        out = self.run_bzr('add -v')[0]
147
146
        os.chdir('new')
148
147
        out, err = self.run_bzr('add --file-ids-from ../base')
149
148
        self.assertEqual('', err)
150
 
        self.assertEqualDiff('adding a w/ file id from a\n'
151
 
                             'adding b w/ file id from b\n'
152
 
                             'adding b/c w/ file id from b/c\n'
153
 
                             'add completed\n',
 
149
        self.assertEqualDiff('added a w/ file id from a\n'
 
150
                             'added b w/ file id from b\n'
 
151
                             'added b/c w/ file id from b/c\n',
154
152
                             out)
155
153
        new_tree = new_tree.bzrdir.open_workingtree()
156
154
        self.assertEqual(base_tree.path2id('a'), new_tree.path2id('a'))
169
167
        os.chdir('new')
170
168
        out, err = self.run_bzr('add --file-ids-from ../base/b')
171
169
        self.assertEqual('', err)
172
 
        self.assertEqualDiff('adding c w/ file id from b/c\n'
173
 
                             'adding d w/ file id from b/d\n'
174
 
                             'add completed\n',
 
170
        self.assertEqualDiff('added c w/ file id from b/c\n'
 
171
                             'added d w/ file id from b/d\n',
175
172
                             out)
176
173
 
177
174
        new_tree = new_tree.bzrdir.open_workingtree()