コード例 #1
0
 def test_upgrade_preserves_signatures(self):
     if not self.repository_format.supports_revision_signatures:
         raise tests.TestNotApplicable(
             "repository does not support signing revisions")
     wt = self.make_branch_and_tree('source')
     wt.commit('A', allow_pointless=True, rev_id='A')
     repo = wt.branch.repository
     repo.lock_write()
     repo.start_write_group()
     try:
         repo.sign_revision('A', gpg.LoopbackGPGStrategy(None))
     except errors.UnsupportedOperation:
         self.assertFalse(repo._format.supports_revision_signatures)
         raise tests.TestNotApplicable(
             "signatures not supported by repository format")
     repo.commit_write_group()
     repo.unlock()
     old_signature = repo.get_signature_text('A')
     try:
         old_format = controldir.ControlDirFormat.get_default_format()
         # This gives metadir branches something they can convert to.
         # it would be nice to have a 'latest' vs 'default' concept.
         format = controldir.format_registry.make_bzrdir(
             'development-subtree')
         upgrade.upgrade(repo.bzrdir.root_transport.base, format=format)
     except errors.UpToDateFormat:
         # this is in the most current format already.
         return
     except errors.BadConversionTarget, e:
         raise tests.TestSkipped(str(e))
コード例 #2
0
 def setUp(self):
     super(AutomaticTagNameTests, self).setUp()
     if isinstance(self.branch_format, branch.BranchReferenceFormat):
         # This test could in principle apply to BranchReferenceFormat, but
         # make_branch_builder doesn't support it.
         raise tests.TestSkipped(
             "BranchBuilder can't make reference branches.")
     self.builder = self.make_branch_builder('.')
     self.builder.build_snapshot('foo',
                                 None,
                                 [('add', ('', None, 'directory', None))],
                                 message='foo')
     self.branch = self.builder.get_branch()
     if not self.branch._format.supports_tags():
         raise tests.TestSkipped("format %s doesn't support tags" %
                                 self.branch._format)
コード例 #3
0
 def get_instrumented_branch(self):
     """Get a Branch object which has been instrumented"""
     # TODO: jam 20060630 It may be that not all formats have a
     # 'control_files' member. So we should fail gracefully if
     # not there. But assuming it has them lets us test the exact
     # lock/unlock order.
     self.locks = []
     b = lock_helpers.LockWrapper(self.locks, self.get_branch(), 'b')
     b.repository = lock_helpers.LockWrapper(self.locks, b.repository, 'r')
     bcf = getattr(b, "control_files", None)
     rcf = getattr(b.repository, 'control_files', None)
     if rcf is None:
         self.combined_branch = False
     else:
         # Look out for branch types that reuse their control files
         self.combined_control = bcf is rcf and bcf is not None
     try:
         b.control_files = lock_helpers.LockWrapper(
             self.locks, b.control_files, 'bc')
     except AttributeError:
         # RemoteBranch seems to trigger this.
         raise tests.TestSkipped(
             'Could not instrument branch control files.')
     if self.combined_control:
         # instrument the repository control files too to ensure its worked
         # with correctly. When they are not shared, we trust the repository
         # API and only instrument the repository itself.
         b.repository.control_files = lock_helpers.LockWrapper(
             self.locks, b.repository.control_files, 'rc')
     return b
コード例 #4
0
 def _create_tree_with_utf8(self, tree):
     """Generate a tree with a utf8 revision and unicode paths."""
     self.requireFeature(features.UnicodeFilenameFeature)
     # We avoid combining characters in file names here, normalization
     # checks (as performed by some file systems (OSX) are outside the scope
     # of these tests).  We use the euro sign \N{Euro Sign} or \u20ac in
     # unicode strings or '\xe2\x82\ac' (its utf-8 encoding) in raw strings.
     paths = [
         u'',
         u'fo\N{Euro Sign}o',
         u'ba\N{Euro Sign}r/',
         u'ba\N{Euro Sign}r/ba\N{Euro Sign}z',
     ]
     # bzr itself does not create unicode file ids, but we want them for
     # testing.
     file_ids = [
         'TREE_ROOT',
         'fo\xe2\x82\xaco-id',
         'ba\xe2\x82\xacr-id',
         'ba\xe2\x82\xacz-id',
     ]
     self.build_tree(paths[1:])
     if tree.get_root_id() is None:
         # Some trees do not have a root yet.
         tree.add(paths, file_ids)
     else:
         # Some trees will already have a root
         tree.set_root_id(file_ids[0])
         tree.add(paths[1:], file_ids[1:])
     try:
         tree.commit(u'in\xedtial', rev_id=u'r\xe9v-1'.encode('utf8'))
     except errors.NonAsciiRevisionId:
         raise tests.TestSkipped('non-ascii revision ids not supported')
コード例 #5
0
    def test_utf8_file_ids_and_revision_ids(self):
        main_wt = self.make_branch_and_tree('main')
        main_branch = main_wt.branch
        self.build_tree(["main/a"])

        file_id = u'a-f\xedle-id'.encode('utf8')
        main_wt.add(['a'], [file_id])
        revision_id = u'r\xe9v-a'.encode('utf8')
        try:
            main_wt.commit('a', rev_id=revision_id)
        except errors.NonAsciiRevisionId:
            raise tests.TestSkipped(
                'non-ascii revision ids not supported by %s' %
                self.repository_format)

        repo = main_wt.branch.repository
        repo.lock_read()
        self.addCleanup(repo.unlock)
        file_ids = repo.fileids_altered_by_revision_ids([revision_id])
        root_id = main_wt.basis_tree().get_root_id()
        if root_id in file_ids:
            self.assertEqual(
                {
                    file_id: set([revision_id]),
                    root_id: set([revision_id])
                }, file_ids)
        else:
            self.assertEqual({file_id: set([revision_id])}, file_ids)
コード例 #6
0
 def test_lock_permission(self):
     if not osutils.supports_posix_readonly():
         raise tests.TestSkipped('Cannot induce a permission failure')
     ld1 = self.get_lock()
     lock_path = ld1.transport.local_abspath('test_lock')
     os.mkdir(lock_path)
     osutils.make_readonly(lock_path)
     self.assertRaises(errors.LockFailed, ld1.attempt_lock)
コード例 #7
0
 def setUp(self):
     super(TestBranchTags, self).setUp()
     # formats that don't support tags can skip the rest of these
     # tests...
     branch = self.make_branch('probe')
     if not branch._format.supports_tags():
         raise tests.TestSkipped("format %s doesn't support tags" %
                                 branch._format)
コード例 #8
0
ファイル: __init__.py プロジェクト: saminigod/cygwin
 def make_branch(self, relpath, format=None):
     repo = self.make_repository(relpath, format=format)
     # fixme RBC 20060210 this isnt necessarily a fixable thing,
     # Skipped is the wrong exception to raise.
     try:
         return self.branch_format.initialize(repo.bzrdir)
     except errors.UninitializableFormat:
         raise tests.TestSkipped('Uninitializable branch format')
コード例 #9
0
 def setUp(self):
     # NB: see http://pad.lv/626679 and
     # <https://code.launchpad.net/~mbp/bzr/626679-strace/+merge/34157>:
     # testing strace by connecting to ourselves has repeatedly caused
     # hangs in running the test suite; these are fixable given enough
     # determination but given that strace is not used by any other tests
     # at the moment and that it's only test-support code, we just leave it
     # untested -- mbp 20100901
     raise tests.TestSkipped("strace selftests are broken and disabled")
コード例 #10
0
 def _check_can_encode_paths(self):
     fs_enc = osutils._fs_enc
     terminal_enc = osutils.get_terminal_encoding()
     fname = self.info['filename']
     dir_name = self.info['directory']
     for thing in [fname, dir_name]:
         try:
             thing.encode(fs_enc)
         except UnicodeEncodeError:
             raise tests.TestSkipped(
                 'Unable to represent path %r in filesystem encoding "%s"'
                 % (thing, fs_enc))
         try:
             thing.encode(terminal_enc)
         except UnicodeEncodeError:
             raise tests.TestSkipped(
                 'Unable to represent path %r in terminal encoding "%s"'
                 ' (even though it is valid in filesystem encoding "%s")'
                 % (thing, terminal_enc, fs_enc))
コード例 #11
0
 def test_read_mergeable_respects_possible_transports(self):
     if not isinstance(self.get_transport(self.bundle_name),
                       bzrlib.transport.ConnectedTransport):
         # There is no point testing transport reuse for not connected
         # transports (the test will fail even).
         raise tests.TestSkipped(
             'Need a ConnectedTransport to test transport reuse')
     url = unicode(self.get_url(self.bundle_name))
     info = self.read_mergeable_from_url(url)
     self.assertEqual(1, len(self.possible_transports))
コード例 #12
0
ファイル: test_add.py プロジェクト: saminigod/cygwin
    def test_add_unicode(self):
        tree = self.make_branch_and_tree('.')
        try:
            self.build_tree([u'f\xf6'])
        except UnicodeError:
            raise tests.TestSkipped('Filesystem does not support filename.')
        tree.add([u'f\xf6'])
        root_id = tree.get_root_id()
        foo_id = tree.path2id(u'f\xf6')

        self.assertTreeLayout([('', root_id), (u'f\xf6', foo_id)], tree)
コード例 #13
0
 def strace_detailed_or_skip(self, *args, **kwargs):
     """Run strace, but cope if it's not allowed"""
     try:
         return strace_detailed(*args, **kwargs)
     except strace.StraceError, e:
         if e.err_messages.startswith(
                 "attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted"
         ):
             raise tests.TestSkipped("ptrace not permitted")
         else:
             raise
コード例 #14
0
    def test_32_lock_wait_succeed(self):
        """Succeed when trying to acquire a lock that gets released

        One thread holds on a lock and then releases it; another 
        tries to lock it.
        """
        # This test sometimes fails like this:
        # Traceback (most recent call last):

        #   File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/tests/
        # test_lockdir.py", line 247, in test_32_lock_wait_succeed
        #     self.assertEqual(1, len(self._logged_reports))
        # AssertionError: not equal:
        # a = 1
        # b = 0
        raise tests.TestSkipped("Test fails intermittently")
        t = self.get_transport()
        lf1 = LockDir(t, 'test_lock')
        lf1.create()
        lf1.attempt_lock()

        def wait_and_unlock():
            time.sleep(0.1)
            lf1.unlock()

        unlocker = Thread(target=wait_and_unlock)
        unlocker.start()
        try:
            lf2 = LockDir(t, 'test_lock')
            self.setup_log_reporter(lf2)
            before = time.time()
            # wait and then lock
            lf2.wait_lock(timeout=0.4, poll=0.1)
            after = time.time()
            self.assertTrue(after - before <= 1.0)
        finally:
            unlocker.join()

        # There should be only 1 report, even though it should have to
        # wait for a while
        lock_base = lf2.transport.abspath(lf2.path)
        self.assertEqual(1, len(self._logged_reports))
        self.assertEqual(
            '%s %s\n'
            '%s\n%s\n'
            'Will continue to try until %s\n', self._logged_reports[0][0])
        args = self._logged_reports[0][1]
        self.assertEqual('Unable to obtain', args[0])
        self.assertEqual('lock %s' % (lock_base, ), args[1])
        self.assertStartsWith(args[2], 'held by ')
        self.assertStartsWith(args[3], 'locked ')
        self.assertEndsWith(args[3], ' ago')
        self.assertContainsRe(args[4], r'\d\d:\d\d:\d\d')
コード例 #15
0
 def disable_commit_write_group_paranoia(self, repo):
     if isinstance(repo, remote.RemoteRepository):
         # We can't easily disable the checks in a remote repo.
         repo.abort_write_group()
         raise tests.TestSkipped(
             "repository format does not support storing revisions with "
             "missing texts.")
     pack_coll = getattr(repo, '_pack_collection', None)
     if pack_coll is not None:
         # Monkey-patch the pack collection instance to allow storing
         # incomplete revisions.
         pack_coll._check_new_inventories = lambda: []
コード例 #16
0
 def setUp(self):
     super(TestTagsMergeToInCheckouts, self).setUp()
     branch1 = self.make_branch('tags-probe')
     if not branch1._format.supports_tags():
         raise tests.TestSkipped("format %s doesn't support tags" %
                                 branch1._format)
     branch2 = self.make_branch('bind-probe')
     try:
         branch2.bind(branch1)
     except errors.UpgradeRequired:
         raise tests.TestNotApplicable(
             "format %s doesn't support bound branches" % branch2._format)
コード例 #17
0
 def test_get_bzr_source_tree(self):
     """Get tree for bzr source, if any."""
     self.permit_source_tree_branch_repo()
     # We don't know if these tests are being run from a checkout or branch
     # of bzr, from an installed copy, or from source unpacked from a
     # tarball.  We don't construct a branch just for testing this, so we
     # just assert that it must either return None or the tree.
     src_tree = version._get_bzr_source_tree()
     if src_tree is None:
         raise tests.TestSkipped(
             "bzr tests aren't run from a bzr working tree")
     else:
         # ensure that what we got was in fact a working tree instance.
         self.assertIsInstance(src_tree, workingtree.WorkingTree)
コード例 #18
0
 def test_no_get_parent_map_after_insert_stream(self):
     # Effort test for bug 331823
     self.setup_smart_server_with_call_log()
     # Make a local branch with four revisions.  Four revisions because:
     # one to push, one there for _walk_to_common_revisions to find, one we
     # don't want to access, one for luck :)
     if isinstance(self.branch_format_from, branch.BranchReferenceFormat):
         # This test could in principle apply to BranchReferenceFormat, but
         # make_branch_builder doesn't support it.
         raise tests.TestSkipped(
             "BranchBuilder can't make reference branches.")
     try:
         builder = self.make_from_branch_builder('local')
     except (errors.TransportNotPossible, errors.UninitializableFormat):
         raise tests.TestNotApplicable('format not directly constructable')
     builder.start_series()
     builder.build_snapshot('first', None,
                            [('add', ('', 'root-id', 'directory', ''))])
     builder.build_snapshot('second', ['first'], [])
     builder.build_snapshot('third', ['second'], [])
     builder.build_snapshot('fourth', ['third'], [])
     builder.finish_series()
     local = branch.Branch.open(self.get_vfs_only_url('local'))
     # Initial push of three revisions
     remote_bzrdir = local.bzrdir.sprout(self.get_url('remote'),
                                         revision_id='third')
     remote = remote_bzrdir.open_branch()
     # Push fourth revision
     self.reset_smart_call_log()
     self.disableOptimisticGetParentMap()
     self.assertFalse(local.is_locked())
     local.push(remote)
     hpss_call_names = [item.call.method for item in self.hpss_calls]
     self.assertTrue('Repository.insert_stream_1.19' in hpss_call_names)
     insert_stream_idx = hpss_call_names.index(
         'Repository.insert_stream_1.19')
     calls_after_insert_stream = hpss_call_names[insert_stream_idx:]
     # After inserting the stream the client has no reason to query the
     # remote graph any further.
     bzr_core_trace = Equals([
         'Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
         'Branch.set_last_revision_info', 'Branch.unlock'
     ])
     bzr_loom_trace = Equals([
         'Repository.insert_stream_1.19', 'Repository.insert_stream_1.19',
         'Branch.set_last_revision_info', 'get', 'Branch.unlock'
     ])
     self.assertThat(calls_after_insert_stream,
                     MatchesAny(bzr_core_trace, bzr_loom_trace))
コード例 #19
0
 def test_location_list(self):
     if sys.platform == 'win32':
         raise tests.TestSkipped('Windows-unfriendly test')
     locs = info.LocationList('/home/foo')
     locs.add_url('a', 'file:///home/foo/')
     locs.add_url('b', 'file:///home/foo/bar/')
     locs.add_url('c', 'file:///home/bar/bar')
     locs.add_url('d', 'http://example.com/example/')
     locs.add_url('e', None)
     self.assertEqual(locs.locs, [('a', '.'), ('b', 'bar'),
                                  ('c', '/home/bar/bar'),
                                  ('d', 'http://example.com/example/')])
     self.assertEqualDiff(
         '  a: .\n  b: bar\n  c: /home/bar/bar\n'
         '  d: http://example.com/example/\n', ''.join(locs.get_lines()))
コード例 #20
0
ファイル: test_subsume.py プロジェクト: saminigod/cygwin
 def test_subsume_failure(self):
     base_tree, sub_tree = self.make_trees()
     if base_tree.get_root_id() == sub_tree.get_root_id():
         raise tests.TestSkipped('This test requires unique roots')
     sub_root_id = sub_tree.get_root_id()
     self.assertRaises(errors.BadSubsumeSource, base_tree.subsume,
                       base_tree)
     self.assertRaises(errors.BadSubsumeSource, sub_tree.subsume, base_tree)
     self.build_tree(['subtree2/'])
     sub_tree2 = self.make_branch_and_tree('subtree2')
     self.assertRaises(errors.BadSubsumeSource, sub_tree.subsume, sub_tree2)
     self.build_tree(['tree/subtree/subtree3/'])
     sub_tree3 = self.make_branch_and_tree('tree/subtree/subtree3')
     self.assertRaises(errors.BadSubsumeSource, base_tree.subsume,
                       sub_tree3)
コード例 #21
0
 def create_linear_history_with_utf8(self):
     tree = self.make_branch_and_memory_tree('tree')
     tree.lock_write()
     try:
         tree.add('')  # needed for MemoryTree
         try:
             tree.commit(u'F\xb5', rev_id=u'rev-\xb5'.encode('utf8'))
         except errors.NonAsciiRevisionId:
             raise tests.TestSkipped("%s doesn't support non-ascii"
                                     " revision ids." %
                                     self.repository_format)
         tree.commit(u'B\xe5r', rev_id=u'rev-\xe5'.encode('utf8'))
     finally:
         tree.unlock()
     return tree
コード例 #22
0
 def test_pull_orphans(self):
     if not self.workingtree_format.missing_parent_conflicts:
         raise tests.TestSkipped(
             '%r does not support missing parent conflicts' %
                 self.workingtree_format)
     trunk = self.make_branch_deleting_dir('trunk')
     work = trunk.bzrdir.sprout('work', revision_id='2').open_workingtree()
     work.branch.get_config_stack().set(
         'bzr.transform.orphan_policy', 'move')
     # Add some unversioned files in dir
     self.build_tree(['work/dir/foo',
                      'work/dir/subdir/',
                      'work/dir/subdir/foo'])
     work.pull(trunk)
     self.assertLength(0, work.conflicts())
     # The directory removal should succeed
     self.assertPathDoesNotExist('work/dir')
コード例 #23
0
    def setUp(self):
        super(TestLocale, self).setUp()

        if sys.platform in ('win32', ):
            raise tests.TestSkipped('Windows does not respond to the LANG'
                                    ' env variable')

        tree = self.make_branch_and_tree('tree')
        self.build_tree(['tree/a'])
        tree.add('a')
        tree.commit(u'Unicode \xb5 commit',
                    rev_id='r1',
                    committer=u'\u062c\u0648\u062c\u0648'
                    u' Meinel <*****@*****.**>',
                    timestamp=1156451297.96,
                    timezone=0)
        self.tree = tree
コード例 #24
0
    def test_push_with_default_stacking_does_not_create_broken_branch(self):
        """Pushing a new standalone branch works even when there's a default
        stacking policy at the destination.

        The new branch will preserve the repo format (even if it isn't the
        default for the branch), and will be stacked when the repo format
        allows (which means that the branch format isn't necessarly preserved).
        """
        if self.bzrdir_format.fixed_components:
            raise tests.TestNotApplicable('Not a metadir format.')
        if isinstance(self.branch_format, branch.BranchReferenceFormat):
            # This test could in principle apply to BranchReferenceFormat, but
            # make_branch_builder doesn't support it.
            raise tests.TestSkipped(
                "BranchBuilder can't make reference branches.")
        # Make a branch called "local" in a stackable repository
        # The branch has 3 revisions:
        #   - rev-1, adds a file
        #   - rev-2, no changes
        #   - rev-3, modifies the file.
        repo = self.make_repository('repo', shared=True, format='1.6')
        builder = self.make_branch_builder('repo/local')
        builder.start_series()
        builder.build_snapshot('rev-1', None,
                               [('add', ('', 'root-id', 'directory', '')),
                                ('add',
                                 ('filename', 'f-id', 'file', 'content\n'))])
        builder.build_snapshot('rev-2', ['rev-1'], [])
        builder.build_snapshot('rev-3', ['rev-2'],
                               [('modify', ('f-id', 'new-content\n'))])
        builder.finish_series()
        trunk = builder.get_branch()
        # Sprout rev-1 to "trunk", so that we can stack on it.
        trunk.bzrdir.sprout(self.get_url('trunk'), revision_id='rev-1')
        # Set a default stacking policy so that new branches will automatically
        # stack on trunk.
        self.make_bzrdir('.').get_config().set_default_stack_on('trunk')
        # Push rev-2 to a new branch "remote".  It will be stacked on "trunk".
        output = StringIO()
        push._show_push_branch(trunk, 'rev-2', self.get_url('remote'), output)
        # Push rev-3 onto "remote".  If "remote" not stacked and is missing the
        # fulltext record for f-id @ rev-1, then this will fail.
        remote_branch = branch.Branch.open(self.get_url('remote'))
        trunk.push(remote_branch)
        check.check_dwim(remote_branch.base, False, True, True)
コード例 #25
0
 def test_sprout_preserves_tags(self):
     """Sprout preserves tags, even tags of absent revisions."""
     try:
         builder = self.make_branch_builder('source')
     except errors.UninitializableFormat:
         raise tests.TestSkipped('Uninitializable branch format')
     builder.build_commit(message="Rev 1", rev_id='rev-1')
     source = builder.get_branch()
     try:
         source.tags.set_tag('tag-a', 'missing-rev')
     except (errors.TagsNotSupported, errors.GhostTagsNotSupported):
         raise tests.TestNotApplicable(
             'Branch format does not support tags or tags to ghosts.')
     # Now source has a tag pointing to an absent revision.  Sprout it.
     target_bzrdir = self.make_repository('target').bzrdir
     new_branch = source.sprout(target_bzrdir)
     # The tag is present in the target
     self.assertEqual('missing-rev', new_branch.tags.lookup_tag('tag-a'))
コード例 #26
0
    def test_34_lock_write_waits(self):
        """LockDir.lock_write() will wait for the lock."""
        # the test suite sets the default to 0 to make deadlocks fail fast.
        # change it for this test, as we want to try a manual deadlock.
        raise tests.TestSkipped('Timing-sensitive test')
        bzrlib.lockdir._DEFAULT_TIMEOUT_SECONDS = 300
        t = self.get_transport()
        lf1 = LockDir(t, 'test_lock')
        lf1.create()
        lf1.attempt_lock()

        def wait_and_unlock():
            time.sleep(0.1)
            lf1.unlock()

        unlocker = Thread(target=wait_and_unlock)
        unlocker.start()
        try:
            lf2 = LockDir(t, 'test_lock')
            self.setup_log_reporter(lf2)
            before = time.time()
            # wait and then lock
            lf2.lock_write()
            after = time.time()
        finally:
            unlocker.join()

        # There should be only 1 report, even though it should have to
        # wait for a while
        lock_base = lf2.transport.abspath(lf2.path)
        self.assertEqual(1, len(self._logged_reports))
        self.assertEqual(
            '%s %s\n'
            '%s\n%s\n'
            'Will continue to try until %s\n', self._logged_reports[0][0])
        args = self._logged_reports[0][1]
        self.assertEqual('Unable to obtain', args[0])
        self.assertEqual('lock %s' % (lock_base, ), args[1])
        self.assertStartsWith(args[2], 'held by ')
        self.assertStartsWith(args[3], 'locked ')
        self.assertEndsWith(args[3], ' ago')
        self.assertContainsRe(args[4], r'\d\d:\d\d:\d\d')
コード例 #27
0
 def test_strict_history(self):
     tree1 = self.make_branch_and_tree('tree1')
     try:
         tree1.branch.set_append_revisions_only(True)
     except errors.UpgradeRequired:
         raise tests.TestSkipped('Format does not support strict history')
     tree1.commit('empty commit')
     tree2 = tree1.bzrdir.sprout('tree2').open_workingtree()
     tree2.commit('empty commit 2')
     tree1.pull(tree2.branch)
     tree1.commit('empty commit 3')
     tree2.commit('empty commit 4')
     self.assertRaises(errors.DivergedBranches, tree1.pull, tree2.branch)
     tree2.merge_from_branch(tree1.branch)
     tree2.commit('empty commit 5')
     self.assertRaises(errors.AppendRevisionsOnlyViolation, tree1.pull,
                       tree2.branch)
     tree3 = tree1.bzrdir.sprout('tree3').open_workingtree()
     tree3.merge_from_branch(tree2.branch)
     tree3.commit('empty commit 6')
     tree2.pull(tree3.branch)
コード例 #28
0
 def test_external_diff(self):
     """Test that we can spawn an external diff process"""
     self.disable_missing_extensions_warning()
     # We have to use run_bzr_subprocess, because we need to
     # test writing directly to stdout, (there was a bug in
     # subprocess.py that we had to workaround).
     # However, if 'diff' may not be available
     self.make_example_branch()
     out, err = self.run_bzr_subprocess(
         'diff -Oprogress_bar=none -r 1 --diff-options -ub',
         universal_newlines=True,
         retcode=None)
     if 'Diff is not installed on this machine' in err:
         raise tests.TestSkipped("No external 'diff' is available")
     self.assertEqual('', err)
     # We have to skip the stuff in the middle, because it depends
     # on time.time()
     self.assertStartsWith(
         out, "=== added file 'goodbye'\n"
         "--- goodbye\t1970-01-01 00:00:00 +0000\n"
         "+++ goodbye\t")
     self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n" "+baz\n\n")
コード例 #29
0
    def setUp(self):
        super(TestFileIdInvolvedSuperset, self).setUp()

        self.branch = None
        main_wt = self.make_branch_and_tree('main')
        main_branch = main_wt.branch
        self.build_tree(["main/a", "main/b", "main/c"])

        main_wt.add(['a', 'b', 'c'], [
            'a-file-id-2006-01-01-abcd', 'b-file-id-2006-01-01-defg',
            'c-funky<file-id>quiji\'"%bo'
        ])
        try:
            main_wt.commit("Commit one", rev_id="rev-A")
        except errors.IllegalPath:
            # TODO: jam 20060701 Consider raising a different exception
            #       newer formats do support this, and nothin can done to
            #       correct this test - its not a bug.
            if sys.platform == 'win32':
                raise tests.TestSkipped('Old repository formats do not'
                                        ' support file ids with <> on win32')
            # This is not a known error condition
            raise

        branch2_wt = self.make_branch_and_tree('branch2')
        branch2_wt.pull(main_branch)
        branch2_bzrdir = branch2_wt.bzrdir
        branch2_branch = branch2_bzrdir.open_branch()
        set_executability(branch2_wt, 'b', True)
        branch2_wt.commit("branch2, Commit one", rev_id="rev-J")

        main_wt.merge_from_branch(branch2_branch)
        set_executability(main_wt, 'b', False)
        main_wt.commit("merge branch1, rev-22", rev_id="rev-G")

        # end G
        self.branch = main_branch
コード例 #30
0
 def test_sprout_branch_nickname(self):
     # test the nick name is reset always
     raise tests.TestSkipped('XXX branch sprouting is not yet tested.')