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

Refactor repository initialization.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    StringIO,
23
23
    )
24
24
import errno
 
25
from dulwich.index import (
 
26
    Index,
 
27
    )
25
28
from dulwich.objects import (
26
29
    Blob,
27
30
    )
46
49
    )
47
50
 
48
51
 
 
52
from bzrlib.plugins.git.dir import (
 
53
    LocalGitDir,
 
54
    )
49
55
from bzrlib.plugins.git.inventory import (
50
56
    GitIndexInventory,
51
57
    )
221
227
    def get_format_description(self):
222
228
        return "Git Working Tree"
223
229
 
 
230
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
 
231
                   accelerator_tree=None, hardlink=False):
 
232
        """See WorkingTreeFormat.initialize()."""
 
233
        if not isinstance(a_bzrdir, LocalGitDir):
 
234
            raise errors.IncompatibleFormat(self, a_bzrdir)
 
235
        index = Index(a_bzrdir.root_transport.local_abspath(".git/index"))
 
236
        index.write()
 
237
        return GitWorkingTree(a_bzrdir, a_bzrdir.open_repository(),
 
238
            a_bzrdir.open_branch(), index)
 
239
 
224
240
 
225
241
class InterIndexGitTree(tree.InterTree):
226
242
    """InterTree that works between a Git revision tree and an index."""