~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_fileid_involved.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
import os
18
17
import sys
19
18
import time
20
19
 
23
22
    remote,
24
23
    revision as _mod_revision,
25
24
    tests,
 
25
    transform,
26
26
    )
27
 
from bzrlib.errors import IllegalPath, NonAsciiRevisionId
28
 
from bzrlib.tests import TestSkipped
29
 
from bzrlib.tests.per_repository.test_repository import TestCaseWithRepository
30
 
from bzrlib.transform import TreeTransform
31
 
from bzrlib.workingtree import WorkingTree
32
 
 
33
 
 
34
 
class FileIdInvolvedBase(TestCaseWithRepository):
 
27
from bzrlib.tests import per_repository
 
28
 
 
29
 
 
30
class FileIdInvolvedBase(per_repository.TestCaseWithRepository):
35
31
 
36
32
    def touch(self, tree, filename):
37
33
        # use the trees transport to not depend on the tree's location or type.
81
77
                                 'c-funky<file-id>quiji%bo'])
82
78
        try:
83
79
            main_wt.commit("Commit one", rev_id="rev-A")
84
 
        except IllegalPath:
 
80
        except errors.IllegalPath:
85
81
            # TODO: jam 20060701 Consider raising a different exception
86
82
            #       newer formats do support this, and nothin can done to
87
83
            #       correct this test - its not a bug.
88
84
            if sys.platform == 'win32':
89
 
                raise TestSkipped('Old repository formats do not'
90
 
                                  ' support file ids with <> on win32')
 
85
                raise tests.TestSkipped('Old repository formats do not'
 
86
                                        ' support file ids with <> on win32')
91
87
            # This is not a known error condition
92
88
            raise
93
89
 
243
239
        revision_id = u'r\xe9v-a'.encode('utf8')
244
240
        try:
245
241
            main_wt.commit('a', rev_id=revision_id)
246
 
        except NonAsciiRevisionId:
247
 
            raise TestSkipped('non-ascii revision ids not supported by %s'
248
 
                              % self.repository_format)
 
242
        except errors.NonAsciiRevisionId:
 
243
            raise tests.TestSkipped('non-ascii revision ids not supported by %s'
 
244
                                    % self.repository_format)
249
245
 
250
246
        repo = main_wt.branch.repository
251
247
        repo.lock_read()
275
271
                                 'c-funky<file-id>quiji\'"%bo'])
276
272
        try:
277
273
            main_wt.commit("Commit one", rev_id="rev-A")
278
 
        except IllegalPath:
 
274
        except errors.IllegalPath:
279
275
            # TODO: jam 20060701 Consider raising a different exception
280
276
            #       newer formats do support this, and nothin can done to
281
277
            #       correct this test - its not a bug.
282
278
            if sys.platform == 'win32':
283
 
                raise TestSkipped('Old repository formats do not'
284
 
                                  ' support file ids with <> on win32')
 
279
                raise tests.TestSkipped('Old repository formats do not'
 
280
                                        ' support file ids with <> on win32')
285
281
            # This is not a known error condition
286
282
            raise
287
283
 
320
316
        self.assertSubset(l2, l1)
321
317
 
322
318
 
323
 
class FileIdInvolvedWGhosts(TestCaseWithRepository):
 
319
class FileIdInvolvedWGhosts(per_repository.TestCaseWithRepository):
324
320
 
325
321
    def create_branch_with_ghost_text(self):
326
322
        builder = self.make_branch_builder('ghost')
352
348
        if isinstance(repo, remote.RemoteRepository):
353
349
            # We can't easily disable the checks in a remote repo.
354
350
            repo.abort_write_group()
355
 
            raise TestSkipped(
 
351
            raise tests.TestSkipped(
356
352
                "repository format does not support storing revisions with "
357
353
                "missing texts.")
358
354
        pack_coll = getattr(repo, '_pack_collection', None)
408
404
    unmark a file as executable.
409
405
    """
410
406
    file_id = wt.path2id(path)
411
 
    tt = TreeTransform(wt)
 
407
    tt = transform.TreeTransform(wt)
412
408
    try:
413
409
        tt.set_executability(executable, tt.trans_id_tree_file_id(file_id))
414
410
        tt.apply()