/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 tests/test_fetch.py

Add more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
from dulwich.objects import (
 
18
    Blob,
 
19
    )
17
20
import os
18
21
 
19
 
from bzrlib.bzrdir import BzrDir
20
 
from bzrlib.repository import Repository
21
 
from bzrlib.tests import TestCaseWithTransport
 
22
from bzrlib import (
 
23
    knit,
 
24
    versionedfile,
 
25
    )
 
26
from bzrlib.bzrdir import (
 
27
    BzrDir,
 
28
    )
 
29
from bzrlib.inventory import (
 
30
    Inventory,
 
31
    )
 
32
from bzrlib.repository import (
 
33
    Repository,
 
34
    )
 
35
from bzrlib.tests import (
 
36
    TestCaseWithTransport,
 
37
    )
 
38
from bzrlib.transport import (
 
39
    get_transport,
 
40
    )
22
41
 
23
42
from bzrlib.plugins.git import (
24
43
    get_rich_root_format,
25
44
    )
26
 
from bzrlib.plugins.git.fetch import BzrFetchGraphWalker
27
 
from bzrlib.plugins.git.mapping import default_mapping
 
45
from bzrlib.plugins.git.fetch import (
 
46
    BzrFetchGraphWalker,
 
47
    import_git_blob,
 
48
    import_git_tree,
 
49
    )
 
50
from bzrlib.plugins.git.mapping import (
 
51
    BzrGitMappingv1,
 
52
    default_mapping,
 
53
    )
 
54
from bzrlib.plugins.git.shamap import (
 
55
    DictGitShaMap,
 
56
    )
28
57
from bzrlib.plugins.git.tests import (
29
58
    GitBranchBuilder,
30
59
    run_git,
92
121
        self.assertEquals(True, tree.inventory[tree.path2id("foobar")].executable)
93
122
        self.assertTrue(tree.has_filename("notexec"))
94
123
        self.assertEquals(False, tree.inventory[tree.path2id("notexec")].executable)
 
124
 
 
125
 
 
126
class ImportObjects(TestCaseWithTransport):
 
127
 
 
128
    def setUp(self):
 
129
        super(ImportObjects, self).setUp()
 
130
        self._map = DictGitShaMap()
 
131
        factory = knit.make_file_factory(True, versionedfile.PrefixMapper())
 
132
        self._texts = factory(self.get_transport('texts'))
 
133
 
 
134
    def test_import_blob_simple(self):
 
135
        blob = Blob.from_string("bar")
 
136
        inv = Inventory()
 
137
        inv.revision_id = "somerevid"
 
138
        import_git_blob(self._texts, BzrGitMappingv1(), "bla", blob, 
 
139
            inv, [], self._map, False)
 
140
        self.assertEquals(set([('bla', 'somerevid')]), self._texts.keys())