13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
"""Tests of the parent related functions of WorkingTrees."""
235
230
def test_unicode_symlink(self):
236
231
# this tests bug #272444
237
self.requireFeature(SymlinkFeature)
238
self.requireFeature(UnicodeFilenameFeature)
232
self.requireFeature(tests.SymlinkFeature)
233
self.requireFeature(tests.UnicodeFilenameFeature)
240
235
tree = self.make_branch_and_tree('tree1')
242
237
# The link points to a file whose name is an omega
243
238
# U+03A9 GREEK CAPITAL LETTER OMEGA
244
239
# UTF-8: ce a9 UTF-16BE: 03a9 Decimal: Ω
245
os.symlink(u'\u03a9','tree1/link_name')
246
tree.add(['link_name'],['link-id'])
241
link_name = u'\N{Euro Sign}link'
242
os.symlink(target, 'tree1/' + link_name)
243
tree.add([link_name],['link-id'])
249
# the actual commit occurs without errors (strangely):
250
revision1 = tree.commit('added a link to a Unicode target')
251
# python 2.4 failed with UnicodeDecodeError on this commit:
252
revision2 = tree.commit('this revision will be discarded')
253
# python 2.5 failed with UnicodeEncodeError on set_parent_ids:
254
tree.set_parent_ids([revision1])
255
except (UnicodeEncodeError, UnicodeDecodeError):
256
raise KnownFailure('there is no support for'
257
' symlinks to non-ASCII targets (bug #272444)')
245
revision1 = tree.commit('added a link to a Unicode target')
246
revision2 = tree.commit('this revision will be discarded')
247
tree.set_parent_ids([revision1])
249
self.addCleanup(tree.unlock)
250
# Check that the symlink target is safely round-tripped in the trees.
251
self.assertEqual(target, tree.get_symlink_target('link-id'))
252
basis = tree.basis_tree()
253
self.assertEqual(target, basis.get_symlink_target('link-id'))
260
256
class TestAddParent(TestParents):