18
18
from cStringIO import StringIO
21
from bzrlib import errors, tests
27
from bzrlib.tests.features import UnicodeFilenameFeature
28
except ImportError: # bzr < 2.5
29
from bzrlib.tests import UnicodeFilenameFeature
22
30
from bzrlib.merge_directive import MergeDirective2
24
32
from bzrlib.plugins.gtk.diff import (
69
77
class TestDiffView(tests.TestCaseWithTransport):
71
79
def test_unicode(self):
72
self.requireFeature(tests.UnicodeFilenameFeature)
80
self.requireFeature(UnicodeFilenameFeature)
74
82
tree = self.make_branch_and_tree('tree')
75
83
self.build_tree([u'tree/\u03a9'])
80
88
view.show_diff(None)
82
90
start, end = buf.get_bounds()
83
text = buf.get_text(start, end)
91
text = buf.get_text(start, end, True)
84
92
self.assertContainsRe(text,
85
93
"=== added file '\xce\xa9'\n"
86
94
'--- .*\t1970-01-01 00:00:00 \\+0000\n'
303
312
[('a-id', 'a', 'removed', 'a'),
304
313
('b-id', 'b', 'removed', 'b/'),
316
def test_status_missing_file(self):
317
this = self.make_branch_and_tree('this')
318
self.build_tree(['this/foo'])
319
this.add(['foo'], ['foo-id'])
322
other = this.bzrdir.sprout('other').open_workingtree()
324
os.remove('this/foo')
325
this.remove('foo', force=True)
326
this.commit('remove')
328
f = open('other/foo', 'wt')
330
f.write('Modified\n')
333
other.commit('modified')
335
this.merge_from_branch(other.branch)
336
conflicts.resolve(this)
338
self.assertStatusEqual(
339
[('foo-id', 'foo.OTHER', 'missing', 'foo.OTHER'),],
342
def test_status_missing_directory(self):
343
this = self.make_branch_and_tree('this')
344
self.build_tree(['this/foo/', 'this/foo/bar'])
345
this.add(['foo', 'foo/bar'], ['foo-id', 'bar-id'])
348
other = this.bzrdir.sprout('other').open_workingtree()
350
os.remove('this/foo/bar')
352
this.remove('foo', force=True)
353
this.commit('remove')
355
f = open('other/foo/bar', 'wt')
357
f.write('Modified\n')
360
other.commit('modified')
362
this.merge_from_branch(other.branch)
363
conflicts.resolve(this)
365
self.assertStatusEqual(
366
[('foo-id', u'foo', 'added', u'foo/'),
367
('bar-id', u'foo/bar.OTHER', 'missing', u'foo/bar.OTHER'),],