/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 remote.py

Fix branch cloning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.trace import info
24
24
from bzrlib.transport import Transport
25
25
 
 
26
from bzrlib.plugins.git import git
26
27
from bzrlib.plugins.git.branch import GitBranch
27
28
from bzrlib.plugins.git.errors import NoSuchRef
28
29
from bzrlib.plugins.git.dir import GitDir
34
35
import urllib
35
36
import urlparse
36
37
 
37
 
import dulwich as git
38
38
from dulwich.pack import PackData, Pack
39
39
 
40
 
# Don't run any tests on GitSmartTransport as it is not intended to be 
41
 
# a full implementation of Transport
42
 
def get_test_permutations():
43
 
    return []
44
 
 
45
40
 
46
41
class GitSmartTransport(Transport):
47
42
 
94
89
    def open_repository(self):
95
90
        return RemoteGitRepository(self, self._lockfiles)
96
91
 
97
 
    def open_branch(self, _unsupported=False):
 
92
    def open_branch(self):
98
93
        repo = self.open_repository()
99
94
        # TODO: Support for multiple branches in one bzrdir in bzrlib!
100
95
        return RemoteGitBranch(self, repo, "HEAD", self._lockfiles)
117
112
        fd, path = tempfile.mkstemp(suffix=".pack")
118
113
        self.fetch_pack(determine_wants, graph_walker, lambda x: os.write(fd, x), progress)
119
114
        os.close(fd)
120
 
        basename = path[:-len(".pack")]
121
 
        p = PackData(path)
122
 
        p.create_index_v2(basename+".idx")
123
 
        pack = Pack(basename)
124
 
        os.remove(path)
125
 
        return (len(p), pack.iterobjects())
 
115
        try:
 
116
            basename = path[:-len(".pack")]
 
117
            p = PackData(path)
 
118
            p.create_index_v2(basename+".idx")
 
119
            for o in Pack(basename).iterobjects():
 
120
                yield o
 
121
        finally:
 
122
            os.remove(path)
126
123
 
127
124
 
128
125
class RemoteGitBranch(GitBranch):