/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_parents.py

  • Committer: Martin Pool
  • Date: 2009-06-05 23:21:51 UTC
  • mfrom: (4415 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4416.
  • Revision ID: mbp@sourcefrog.net-20090605232151-luwmyyl95siraqyz
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
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
16
16
 
17
17
"""Tests of the parent related functions of WorkingTrees."""
18
18
 
24
24
    osutils,
25
25
    revision as _mod_revision,
26
26
    symbol_versioning,
 
27
    tests,
27
28
    )
28
29
from bzrlib.inventory import (
29
30
    Inventory,
32
33
    InventoryLink,
33
34
    )
34
35
from bzrlib.revision import Revision
35
 
from bzrlib.tests import (
36
 
    KnownFailure,
37
 
    SymlinkFeature,
38
 
    TestNotApplicable,
39
 
    UnicodeFilenameFeature,
40
 
    )
41
36
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
42
37
from bzrlib.uncommit import uncommit
43
38
 
234
229
 
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)
239
234
 
240
235
        tree = self.make_branch_and_tree('tree1')
241
236
 
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'])
 
240
        target = u'\u03a9'
 
241
        link_name = u'\N{Euro Sign}link'
 
242
        os.symlink(target, 'tree1/' + link_name)
 
243
        tree.add([link_name],['link-id'])
247
244
 
248
 
        try:
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])
 
248
        tree.lock_read()
 
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'))
258
254
 
259
255
 
260
256
class TestAddParent(TestParents):