~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: John Arbash Meinel
  • Date: 2010-05-11 14:14:55 UTC
  • mfrom: (5223.1.1 global_chk_attrs)
  • mto: This revision was merged to the branch mainline in revision 5225.
  • Revision ID: john@arbash-meinel.com-20100511141455-5xq2dqfei11m5lms
Bring in the global chk change, which includes some more bzr.dev code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    filters,
26
26
    generate_ids,
27
27
    osutils,
28
 
    progress,
29
28
    revision as _mod_revision,
30
29
    rules,
31
30
    tests,
32
31
    urlutils,
33
32
    )
34
33
from bzrlib.bzrdir import BzrDir
35
 
from bzrlib.conflicts import (DuplicateEntry, DuplicateID, MissingParent,
36
 
                              UnversionedParent, ParentLoop, DeletingParent,
37
 
                              NonDirectoryParent)
 
34
from bzrlib.conflicts import (
 
35
    DeletingParent,
 
36
    DuplicateEntry,
 
37
    DuplicateID,
 
38
    MissingParent,
 
39
    NonDirectoryParent,
 
40
    ParentLoop,
 
41
    UnversionedParent,
 
42
)
38
43
from bzrlib.diff import show_diff_trees
39
 
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
40
 
                           ReusingTransform, CantMoveRoot,
41
 
                           PathsNotVersionedError, ExistingLimbo,
42
 
                           ExistingPendingDeletion, ImmortalLimbo,
43
 
                           ImmortalPendingDeletion, LockError)
44
 
from bzrlib.osutils import file_kind, pathjoin
 
44
from bzrlib.errors import (
 
45
    DuplicateKey,
 
46
    ExistingLimbo,
 
47
    ExistingPendingDeletion,
 
48
    ImmortalLimbo,
 
49
    ImmortalPendingDeletion,
 
50
    LockError,
 
51
    MalformedTransform,
 
52
    NoSuchFile,
 
53
    ReusingTransform,
 
54
)
 
55
from bzrlib.osutils import (
 
56
    file_kind,
 
57
    pathjoin,
 
58
)
45
59
from bzrlib.merge import Merge3Merger, Merger
46
60
from bzrlib.tests import (
47
61
    HardlinkFeature,
49
63
    TestCase,
50
64
    TestCaseInTempDir,
51
65
    TestSkipped,
52
 
    )
53
 
from bzrlib.transform import (TreeTransform, ROOT_PARENT, FinalPaths,
54
 
                              resolve_conflicts, cook_conflicts,
55
 
                              build_tree, get_backup_name,
56
 
                              _FileMover, resolve_checkout,
57
 
                              TransformPreview, create_from_tree)
 
66
)
 
67
from bzrlib.transform import (
 
68
    build_tree,
 
69
    create_from_tree,
 
70
    cook_conflicts,
 
71
    _FileMover,
 
72
    FinalPaths,
 
73
    get_backup_name,
 
74
    resolve_conflicts,
 
75
    resolve_checkout,
 
76
    ROOT_PARENT,
 
77
    TransformPreview,
 
78
    TreeTransform,
 
79
)
58
80
 
59
81
 
60
82
class TestTreeTransform(tests.TestCaseWithTransport):
2091
2113
        self.assertRaises(errors.MalformedTransform, tt.commit, branch,
2092
2114
                          'message')
2093
2115
 
 
2116
    def test_commit_rich_revision_data(self):
 
2117
        branch, tt = self.get_branch_and_transform()
 
2118
        rev_id = tt.commit(branch, 'message', timestamp=1, timezone=43201,
 
2119
                           committer='me <me@example.com>',
 
2120
                           revprops={'foo': 'bar'}, revision_id='revid-1',
 
2121
                           authors=['Author1 <author1@example.com>',
 
2122
                              'Author2 <author2@example.com>',
 
2123
                               ])
 
2124
        self.assertEqual('revid-1', rev_id)
 
2125
        revision = branch.repository.get_revision(rev_id)
 
2126
        self.assertEqual(1, revision.timestamp)
 
2127
        self.assertEqual(43201, revision.timezone)
 
2128
        self.assertEqual('me <me@example.com>', revision.committer)
 
2129
        self.assertEqual(['Author1 <author1@example.com>',
 
2130
                          'Author2 <author2@example.com>'],
 
2131
                         revision.get_apparent_authors())
 
2132
        del revision.properties['authors']
 
2133
        self.assertEqual({'foo': 'bar',
 
2134
                          'branch-nick': 'tree'},
 
2135
                         revision.properties)
 
2136
 
 
2137
    def test_no_explicit_revprops(self):
 
2138
        branch, tt = self.get_branch_and_transform()
 
2139
        rev_id = tt.commit(branch, 'message', authors=[
 
2140
            'Author1 <author1@example.com>',
 
2141
            'Author2 <author2@example.com>', ])
 
2142
        revision = branch.repository.get_revision(rev_id)
 
2143
        self.assertEqual(['Author1 <author1@example.com>',
 
2144
                          'Author2 <author2@example.com>'],
 
2145
                         revision.get_apparent_authors())
 
2146
        self.assertEqual('tree', revision.properties['branch-nick'])
 
2147
 
2094
2148
 
2095
2149
class MockTransform(object):
2096
2150