/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 lazy_check_versions
27
 
lazy_check_versions()
28
 
 
 
26
from bzrlib.plugins.git import git
29
27
from bzrlib.plugins.git.branch import GitBranch
30
28
from bzrlib.plugins.git.errors import NoSuchRef
31
29
from bzrlib.plugins.git.dir import GitDir
37
35
import urllib
38
36
import urlparse
39
37
 
40
 
import dulwich as git
41
38
from dulwich.pack import PackData, Pack
42
39
 
43
 
# Don't run any tests on GitSmartTransport as it is not intended to be 
44
 
# a full implementation of Transport
45
 
def get_test_permutations():
46
 
    return []
47
 
 
48
40
 
49
41
class GitSmartTransport(Transport):
50
42
 
97
89
    def open_repository(self):
98
90
        return RemoteGitRepository(self, self._lockfiles)
99
91
 
100
 
    def open_branch(self, _unsupported=False):
 
92
    def open_branch(self):
101
93
        repo = self.open_repository()
102
94
        # TODO: Support for multiple branches in one bzrdir in bzrlib!
103
95
        return RemoteGitBranch(self, repo, "HEAD", self._lockfiles)
120
112
        fd, path = tempfile.mkstemp(suffix=".pack")
121
113
        self.fetch_pack(determine_wants, graph_walker, lambda x: os.write(fd, x), progress)
122
114
        os.close(fd)
123
 
        basename = path[:-len(".pack")]
124
 
        p = PackData(path)
125
 
        p.create_index_v2(basename+".idx")
126
 
        pack = Pack(basename)
127
 
        os.remove(path)
128
 
        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)
129
123
 
130
124
 
131
125
class RemoteGitBranch(GitBranch):