/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_diff.py

  • Committer: Mark Lee
  • Date: 2009-07-11 18:39:14 UTC
  • mto: This revision was merged to the branch mainline in revision 661.
  • Revision ID: bzr@lazymalevolence.com-20090711183914-zuii3et5skiv2njo
Re-ignore credits.pickle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from cStringIO import StringIO
19
19
import os
20
20
 
21
 
from bzrlib import errors, tests
 
21
from bzrlib import (
 
22
    conflicts,
 
23
    errors,
 
24
    tests,
 
25
    )
22
26
from bzrlib.merge_directive import MergeDirective2
23
27
 
24
28
from bzrlib.plugins.gtk.diff import (
303
307
            [('a-id', 'a', 'removed', 'a'),
304
308
             ('b-id', 'b', 'removed', 'b/'),
305
309
            ], tree)
 
310
 
 
311
    def test_status_missing_file(self):
 
312
        this = self.make_branch_and_tree('this')
 
313
        self.build_tree(['this/foo'])
 
314
        this.add(['foo'], ['foo-id'])
 
315
        this.commit('add')
 
316
 
 
317
        other = this.bzrdir.sprout('other').open_workingtree()
 
318
 
 
319
        os.remove('this/foo')
 
320
        this.remove('foo', force=True)
 
321
        this.commit('remove')
 
322
 
 
323
        f = open('other/foo', 'wt')
 
324
        try:
 
325
            f.write('Modified\n')
 
326
        finally:
 
327
            f.close()
 
328
        other.commit('modified')
 
329
 
 
330
        this.merge_from_branch(other.branch)
 
331
        conflicts.resolve(this)
 
332
 
 
333
        self.assertStatusEqual(
 
334
            [('foo-id', 'foo.OTHER', 'missing', 'foo.OTHER'),],
 
335
            this)
 
336
 
 
337
    def test_status_missing_directory(self):
 
338
        this = self.make_branch_and_tree('this')
 
339
        self.build_tree(['this/foo/', 'this/foo/bar'])
 
340
        this.add(['foo', 'foo/bar'], ['foo-id', 'bar-id'])
 
341
        this.commit('add')
 
342
 
 
343
        other = this.bzrdir.sprout('other').open_workingtree()
 
344
 
 
345
        os.remove('this/foo/bar')
 
346
        os.rmdir('this/foo')
 
347
        this.remove('foo', force=True)
 
348
        this.commit('remove')
 
349
 
 
350
        f = open('other/foo/bar', 'wt')
 
351
        try:
 
352
            f.write('Modified\n')
 
353
        finally:
 
354
            f.close()
 
355
        other.commit('modified')
 
356
 
 
357
        this.merge_from_branch(other.branch)
 
358
        conflicts.resolve(this)
 
359
 
 
360
        self.assertStatusEqual(
 
361
            [('foo-id', u'foo', 'added', u'foo/'),
 
362
             ('bar-id', u'foo/bar.OTHER', 'missing', u'foo/bar.OTHER'),],
 
363
            this)