1051
995
self.deleted(tree1, 'e-id'),
1053
997
self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
999
def test_added_unicode(self):
1000
tree1 = self.make_branch_and_tree('tree1')
1001
tree2 = self.make_to_branch_and_tree('tree2')
1002
root_id = tree1.get_root_id()
1003
tree2.set_root_id(root_id)
1005
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1006
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1007
a_id = u'\u03b1-id'.encode('utf8')
1008
added_id = u'\u03c9_added_id'.encode('utf8')
1010
self.build_tree([u'tree1/\u03b1/',
1012
u'tree2/\u03b1/\u03c9-added',
1014
except UnicodeError:
1015
raise tests.TestSkipped("Could not create Unicode files.")
1016
tree1.add([u'\u03b1'], [a_id])
1017
tree2.add([u'\u03b1', u'\u03b1/\u03c9-added'], [a_id, added_id])
1019
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1021
self.assertEqual([self.added(tree2, added_id)],
1022
self.do_iter_changes(tree1, tree2))
1023
self.assertEqual([self.added(tree2, added_id)],
1024
self.do_iter_changes(tree1, tree2,
1025
specific_files=[u'\u03b1']))
1027
def test_deleted_unicode(self):
1028
tree1 = self.make_branch_and_tree('tree1')
1029
tree2 = self.make_to_branch_and_tree('tree2')
1030
root_id = tree1.get_root_id()
1031
tree2.set_root_id(root_id)
1033
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1034
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1035
a_id = u'\u03b1-id'.encode('utf8')
1036
deleted_id = u'\u03c9_deleted_id'.encode('utf8')
1038
self.build_tree([u'tree1/\u03b1/',
1039
u'tree1/\u03b1/\u03c9-deleted',
1042
except UnicodeError:
1043
raise tests.TestSkipped("Could not create Unicode files.")
1044
tree1.add([u'\u03b1', u'\u03b1/\u03c9-deleted'], [a_id, deleted_id])
1045
tree2.add([u'\u03b1'], [a_id])
1047
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1049
self.assertEqual([self.deleted(tree1, deleted_id)],
1050
self.do_iter_changes(tree1, tree2))
1051
self.assertEqual([self.deleted(tree1, deleted_id)],
1052
self.do_iter_changes(tree1, tree2,
1053
specific_files=[u'\u03b1']))
1055
def test_modified_unicode(self):
1056
tree1 = self.make_branch_and_tree('tree1')
1057
tree2 = self.make_to_branch_and_tree('tree2')
1058
root_id = tree1.get_root_id()
1059
tree2.set_root_id(root_id)
1061
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1062
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1063
a_id = u'\u03b1-id'.encode('utf8')
1064
mod_id = u'\u03c9_mod_id'.encode('utf8')
1066
self.build_tree([u'tree1/\u03b1/',
1067
u'tree1/\u03b1/\u03c9-modified',
1069
u'tree2/\u03b1/\u03c9-modified',
1071
except UnicodeError:
1072
raise tests.TestSkipped("Could not create Unicode files.")
1073
tree1.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id])
1074
tree2.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id])
1076
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1078
self.assertEqual([self.content_changed(tree1, mod_id)],
1079
self.do_iter_changes(tree1, tree2))
1080
self.assertEqual([self.content_changed(tree1, mod_id)],
1081
self.do_iter_changes(tree1, tree2,
1082
specific_files=[u'\u03b1']))
1084
def test_renamed_unicode(self):
1085
tree1 = self.make_branch_and_tree('tree1')
1086
tree2 = self.make_to_branch_and_tree('tree2')
1087
root_id = tree1.get_root_id()
1088
tree2.set_root_id(root_id)
1090
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1091
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1092
a_id = u'\u03b1-id'.encode('utf8')
1093
rename_id = u'\u03c9_rename_id'.encode('utf8')
1095
self.build_tree([u'tree1/\u03b1/',
1098
except UnicodeError:
1099
raise tests.TestSkipped("Could not create Unicode files.")
1100
self.build_tree_contents([(u'tree1/\u03c9-source', 'contents\n'),
1101
(u'tree2/\u03b1/\u03c9-target', 'contents\n'),
1103
tree1.add([u'\u03b1', u'\u03c9-source'], [a_id, rename_id])
1104
tree2.add([u'\u03b1', u'\u03b1/\u03c9-target'], [a_id, rename_id])
1106
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1108
self.assertEqual([self.renamed(tree1, tree2, rename_id, False)],
1109
self.do_iter_changes(tree1, tree2))
1110
self.assertEqual([self.renamed(tree1, tree2, rename_id, False)],
1111
self.do_iter_changes(tree1, tree2,
1112
specific_files=[u'\u03b1']))
1114
def test_unchanged_unicode(self):
1115
tree1 = self.make_branch_and_tree('tree1')
1116
tree2 = self.make_to_branch_and_tree('tree2')
1117
root_id = tree1.get_root_id()
1118
tree2.set_root_id(root_id)
1119
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1120
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1121
a_id = u'\u03b1-id'.encode('utf8')
1122
subfile_id = u'\u03c9-subfile-id'.encode('utf8')
1123
rootfile_id = u'\u03c9-root-id'.encode('utf8')
1125
self.build_tree([u'tree1/\u03b1/',
1128
except UnicodeError:
1129
raise tests.TestSkipped("Could not create Unicode files.")
1130
self.build_tree_contents([
1131
(u'tree1/\u03b1/\u03c9-subfile', 'sub contents\n'),
1132
(u'tree2/\u03b1/\u03c9-subfile', 'sub contents\n'),
1133
(u'tree1/\u03c9-rootfile', 'root contents\n'),
1134
(u'tree2/\u03c9-rootfile', 'root contents\n'),
1136
tree1.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'],
1137
[a_id, subfile_id, rootfile_id])
1138
tree2.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'],
1139
[a_id, subfile_id, rootfile_id])
1141
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1144
self.unchanged(tree1, root_id),
1145
self.unchanged(tree1, a_id),
1146
self.unchanged(tree1, subfile_id),
1147
self.unchanged(tree1, rootfile_id),
1149
self.assertEqual(expected,
1150
self.do_iter_changes(tree1, tree2,
1151
include_unchanged=True))
1153
# We should also be able to select just a subset
1155
self.unchanged(tree1, a_id),
1156
self.unchanged(tree1, subfile_id),
1158
self.assertEqual(expected,
1159
self.do_iter_changes(tree1, tree2,
1160
specific_files=[u'\u03b1'],
1161
include_unchanged=True))
1163
def test_unknown_unicode(self):
1164
tree1 = self.make_branch_and_tree('tree1')
1165
tree2 = self.make_to_branch_and_tree('tree2')
1166
root_id = tree1.get_root_id()
1167
tree2.set_root_id(root_id)
1168
# u'\u03b1' == GREEK SMALL LETTER ALPHA
1169
# u'\u03c9' == GREEK SMALL LETTER OMEGA
1170
a_id = u'\u03b1-id'.encode('utf8')
1172
self.build_tree([u'tree1/\u03b1/',
1174
u'tree2/\u03b1/unknown_dir/',
1175
u'tree2/\u03b1/unknown_file',
1176
u'tree2/\u03b1/unknown_dir/file',
1177
u'tree2/\u03c9-unknown_root_file',
1179
except UnicodeError:
1180
raise tests.TestSkipped("Could not create Unicode files.")
1181
tree1.add([u'\u03b1'], [a_id])
1182
tree2.add([u'\u03b1'], [a_id])
1184
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
1187
self.unversioned(tree2, u'\u03b1/unknown_dir'),
1188
self.unversioned(tree2, u'\u03b1/unknown_file'),
1189
self.unversioned(tree2, u'\u03c9-unknown_root_file'),
1190
# a/unknown_dir/file should not be included because we should not
1191
# recurse into unknown_dir
1192
# self.unversioned(tree2, 'a/unknown_dir/file'),
1194
self.assertEqual(expected,
1195
self.do_iter_changes(tree1, tree2,
1196
require_versioned=False,
1197
want_unversioned=True))
1198
self.assertEqual([], # Without want_unversioned we should get nothing
1199
self.do_iter_changes(tree1, tree2))
1201
# We should also be able to select just a subset
1203
self.unversioned(tree2, u'\u03b1/unknown_dir'),
1204
self.unversioned(tree2, u'\u03b1/unknown_file'),
1206
self.assertEqual(expected,
1207
self.do_iter_changes(tree1, tree2,
1208
specific_files=[u'\u03b1'],
1209
require_versioned=False,
1210
want_unversioned=True))
1211
self.assertEqual([], # Without want_unversioned we should get nothing
1212
self.do_iter_changes(tree1, tree2,
1213
specific_files=[u'\u03b1']))