~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/fixtures.py

  • Committer: Andrew Bennetts
  • Date: 2011-02-09 06:36:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5660.
  • Revision ID: andrew.bennetts@canonical.com-20110209063635-77bt3r16v9oz565k
Simplify new fixture slightly, and other test tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
import itertools
29
29
 
30
 
from bzrlib import (
31
 
    errors,
32
 
    tests,
33
 
    )
34
 
 
35
30
 
36
31
def generate_unicode_names():
37
32
    """Generate a sequence of arbitrary unique unicode names.
104
99
        return False # propogate exceptions.
105
100
 
106
101
 
107
 
def build_branch_with_non_ancestral_tag(branch_builder):
108
 
    """Builds a branch with a tag not in the ancestry of the tip.
 
102
def build_branch_with_non_ancestral_rev(branch_builder):
 
103
    """Builds a branch with a rev not in the ancestry of the tip.
109
104
 
110
105
    This is the revision graph::
111
106
 
115
110
        |
116
111
      (null)
117
112
 
118
 
    The branch tip is 'rev-1', and the branch tags will be {'tag-a': 'rev-2'}.
 
113
    The branch tip is 'rev-1'.  'rev-2' is present in the branch's repository,
 
114
    but is not part of rev-1's ancestry.
119
115
 
120
116
    :param branch_builder: A BranchBuilder (e.g. from
121
117
        TestCaseWithMemoryTransport.make_branch_builder).
122
 
    :returns: the branch
123
 
    :raises: TestNotApplicable if the branch built by branch_builder doesn't
124
 
        support tags.
 
118
    :returns: the new branch
125
119
    """
 
120
    # Make a sequence of two commits
126
121
    branch_builder.build_commit(message="Rev 1", rev_id='rev-1')
 
122
    branch_builder.build_commit(message="Rev 2", rev_id='rev-2')
 
123
    # Move the branch tip back to the first commit
127
124
    source = branch_builder.get_branch()
128
 
    # Add a non-ancestry tag to source
129
 
    branch_builder.build_commit(message="Rev 2", rev_id='rev-2')
130
 
    try:
131
 
        source.tags.set_tag('tag-a', 'rev-2')
132
 
    except errors.TagsNotSupported:
133
 
        raise tests.TestNotApplicable('format does not support tags.')
134
125
    source.set_last_revision_info(1, 'rev-1')
135
126
    return source
136
127