1020
1000
self.deleted(tree1, 'e-id'),
1022
1002
self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
1004
def test_added_unicode(self):
1005
tree1 = self.make_branch_and_tree('tree1')
1006
tree2 = self.make_to_branch_and_tree('tree2')
1007
root_id = tree1.get_root_id()
1008
tree2.set_root_id(root_id)
1010
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1011
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1012
a_id = u'\u03b1-id'.encode('utf8')
1013
added_id = u'\u03c9_added_id'.encode('utf8')
1015
self.build_tree([u'tree1/\u03b1/',
1017
u'tree2/\u03b1/\u03c9-added',
1019
except UnicodeError:
1020
raise tests.TestSkipped("Could not create Unicode files.")
1021
tree1.add([u'\u03b1'], [a_id])
1022
tree2.add([u'\u03b1', u'\u03b1/\u03c9-added'], [a_id, added_id])
1024
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1026
self.assertEqual([self.added(tree2, added_id)],
1027
self.do_iter_changes(tree1, tree2))
1028
self.assertEqual([self.added(tree2, added_id)],
1029
self.do_iter_changes(tree1, tree2,
1030
specific_files=[u'\u03b1']))
1032
def test_deleted_unicode(self):
1033
tree1 = self.make_branch_and_tree('tree1')
1034
tree2 = self.make_to_branch_and_tree('tree2')
1035
root_id = tree1.get_root_id()
1036
tree2.set_root_id(root_id)
1038
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1039
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1040
a_id = u'\u03b1-id'.encode('utf8')
1041
deleted_id = u'\u03c9_deleted_id'.encode('utf8')
1043
self.build_tree([u'tree1/\u03b1/',
1044
u'tree1/\u03b1/\u03c9-deleted',
1047
except UnicodeError:
1048
raise tests.TestSkipped("Could not create Unicode files.")
1049
tree1.add([u'\u03b1', u'\u03b1/\u03c9-deleted'], [a_id, deleted_id])
1050
tree2.add([u'\u03b1'], [a_id])
1052
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1054
self.assertEqual([self.deleted(tree1, deleted_id)],
1055
self.do_iter_changes(tree1, tree2))
1056
self.assertEqual([self.deleted(tree1, deleted_id)],
1057
self.do_iter_changes(tree1, tree2,
1058
specific_files=[u'\u03b1']))
1060
def test_modified_unicode(self):
1061
tree1 = self.make_branch_and_tree('tree1')
1062
tree2 = self.make_to_branch_and_tree('tree2')
1063
root_id = tree1.get_root_id()
1064
tree2.set_root_id(root_id)
1066
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1067
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1068
a_id = u'\u03b1-id'.encode('utf8')
1069
mod_id = u'\u03c9_mod_id'.encode('utf8')
1071
self.build_tree([u'tree1/\u03b1/',
1072
u'tree1/\u03b1/\u03c9-modified',
1074
u'tree2/\u03b1/\u03c9-modified',
1076
except UnicodeError:
1077
raise tests.TestSkipped("Could not create Unicode files.")
1078
tree1.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id])
1079
tree2.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id])
1081
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1083
self.assertEqual([self.content_changed(tree1, mod_id)],
1084
self.do_iter_changes(tree1, tree2))
1085
self.assertEqual([self.content_changed(tree1, mod_id)],
1086
self.do_iter_changes(tree1, tree2,
1087
specific_files=[u'\u03b1']))
1089
def test_renamed_unicode(self):
1090
tree1 = self.make_branch_and_tree('tree1')
1091
tree2 = self.make_to_branch_and_tree('tree2')
1092
root_id = tree1.get_root_id()
1093
tree2.set_root_id(root_id)
1095
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1096
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1097
a_id = u'\u03b1-id'.encode('utf8')
1098
rename_id = u'\u03c9_rename_id'.encode('utf8')
1100
self.build_tree([u'tree1/\u03b1/',
1103
except UnicodeError:
1104
raise tests.TestSkipped("Could not create Unicode files.")
1105
self.build_tree_contents([(u'tree1/\u03c9-source', 'contents\n'),
1106
(u'tree2/\u03b1/\u03c9-target', 'contents\n'),
1108
tree1.add([u'\u03b1', u'\u03c9-source'], [a_id, rename_id])
1109
tree2.add([u'\u03b1', u'\u03b1/\u03c9-target'], [a_id, rename_id])
1111
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1113
self.assertEqual([self.renamed(tree1, tree2, rename_id, False)],
1114
self.do_iter_changes(tree1, tree2))
1115
self.assertEqual([self.renamed(tree1, tree2, rename_id, False)],
1116
self.do_iter_changes(tree1, tree2,
1117
specific_files=[u'\u03b1']))
1119
def test_unchanged_unicode(self):
1120
tree1 = self.make_branch_and_tree('tree1')
1121
tree2 = self.make_to_branch_and_tree('tree2')
1122
root_id = tree1.get_root_id()
1123
tree2.set_root_id(root_id)
1124
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1125
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1126
a_id = u'\u03b1-id'.encode('utf8')
1127
subfile_id = u'\u03c9-subfile-id'.encode('utf8')
1128
rootfile_id = u'\u03c9-root-id'.encode('utf8')
1130
self.build_tree([u'tree1/\u03b1/',
1133
except UnicodeError:
1134
raise tests.TestSkipped("Could not create Unicode files.")
1135
self.build_tree_contents([
1136
(u'tree1/\u03b1/\u03c9-subfile', 'sub contents\n'),
1137
(u'tree2/\u03b1/\u03c9-subfile', 'sub contents\n'),
1138
(u'tree1/\u03c9-rootfile', 'root contents\n'),
1139
(u'tree2/\u03c9-rootfile', 'root contents\n'),
1141
tree1.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'],
1142
[a_id, subfile_id, rootfile_id])
1143
tree2.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'],
1144
[a_id, subfile_id, rootfile_id])
1146
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1149
self.unchanged(tree1, root_id),
1150
self.unchanged(tree1, a_id),
1151
self.unchanged(tree1, subfile_id),
1152
self.unchanged(tree1, rootfile_id),
1154
self.assertEqual(expected,
1155
self.do_iter_changes(tree1, tree2,
1156
include_unchanged=True))
1158
# We should also be able to select just a subset
1160
self.unchanged(tree1, a_id),
1161
self.unchanged(tree1, subfile_id),
1163
self.assertEqual(expected,
1164
self.do_iter_changes(tree1, tree2,
1165
specific_files=[u'\u03b1'],
1166
include_unchanged=True))
1168
def test_unknown_unicode(self):
1169
tree1 = self.make_branch_and_tree('tree1')
1170
tree2 = self.make_to_branch_and_tree('tree2')
1171
root_id = tree1.get_root_id()
1172
tree2.set_root_id(root_id)
1173
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1174
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1175
a_id = u'\u03b1-id'.encode('utf8')
1177
self.build_tree([u'tree1/\u03b1/',
1179
u'tree2/\u03b1/unknown_dir/',
1180
u'tree2/\u03b1/unknown_file',
1181
u'tree2/\u03b1/unknown_dir/file',
1182
u'tree2/\u03c9-unknown_root_file',
1184
except UnicodeError:
1185
raise tests.TestSkipped("Could not create Unicode files.")
1186
tree1.add([u'\u03b1'], [a_id])
1187
tree2.add([u'\u03b1'], [a_id])
1189
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1192
self.unversioned(tree2, u'\u03b1/unknown_dir'),
1193
self.unversioned(tree2, u'\u03b1/unknown_file'),
1194
self.unversioned(tree2, u'\u03c9-unknown_root_file'),
1195
# a/unknown_dir/file should not be included because we should not
1196
# recurse into unknown_dir
1197
# self.unversioned(tree2, 'a/unknown_dir/file'),
1199
self.assertEqual(expected,
1200
self.do_iter_changes(tree1, tree2,
1201
require_versioned=False,
1202
want_unversioned=True))
1203
self.assertEqual([], # Without want_unversioned we should get nothing
1204
self.do_iter_changes(tree1, tree2))
1206
# We should also be able to select just a subset
1208
self.unversioned(tree2, u'\u03b1/unknown_dir'),
1209
self.unversioned(tree2, u'\u03b1/unknown_file'),
1211
self.assertEqual(expected,
1212
self.do_iter_changes(tree1, tree2,
1213
specific_files=[u'\u03b1'],
1214
require_versioned=False,
1215
want_unversioned=True))
1216
self.assertEqual([], # Without want_unversioned we should get nothing
1217
self.do_iter_changes(tree1, tree2,
1218
specific_files=[u'\u03b1']))
1220
def test_unknown_empty_dir(self):
1221
tree1 = self.make_branch_and_tree('tree1')
1222
tree2 = self.make_to_branch_and_tree('tree2')
1223
root_id = tree1.get_root_id()
1224
tree2.set_root_id(root_id)
1226
# Start with 2 identical trees
1227
self.build_tree(['tree1/a/', 'tree1/b/',
1228
'tree2/a/', 'tree2/b/'])
1229
self.build_tree_contents([('tree1/b/file', 'contents\n'),
1230
('tree2/b/file', 'contents\n')])
1231
tree1.add(['a', 'b', 'b/file'], ['a-id', 'b-id', 'b-file-id'])
1232
tree2.add(['a', 'b', 'b/file'], ['a-id', 'b-id', 'b-file-id'])
1234
# Now create some unknowns in tree2
1235
# We should find both a/file and a/dir as unknown, but we shouldn't
1236
# recurse into a/dir to find that a/dir/subfile is also unknown.
1237
self.build_tree(['tree2/a/file', 'tree2/a/dir/', 'tree2/a/dir/subfile'])
1239
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1242
self.unversioned(tree2, u'a/file'),
1243
self.unversioned(tree2, u'a/dir'),
1245
self.assertEqual(expected,
1246
self.do_iter_changes(tree1, tree2,
1247
require_versioned=False,
1248
want_unversioned=True))