/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

Use transports in git-import.

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
    )
108
114
        finally:
109
115
            self.branch.unlock()
110
116
 
111
 
    def is_control_filename(self, path):
112
 
        return os.path.basename(path) == ".git"
113
 
 
114
117
    def _rewrite_index(self):
115
118
        self.index.clear()
116
119
        for path, entry in self._inventory.iter_entries():
136
139
                    # old index
137
140
                    from posix import stat_result
138
141
                    stat_val = stat_result((stat.S_IFLNK, 0, 0, 0, 0, 0, 0, 0, 0, 0))
139
 
                blob.set_raw_string(entry.symlink_target)
 
142
                blob.set_raw_string(self.get_symlink_target(entry.file_id).encode("utf-8"))
140
143
            else:
141
144
                raise AssertionError("unknown kind '%s'" % entry.kind)
142
145
            # Add object to the repository if it didn't exist yet
215
218
 
216
219
    @property
217
220
    def _matchingbzrdir(self):
218
 
        from bzrlib.plugins.git import LocalGitControlDirFormat
 
221
        from bzrlib.plugins.git.dir import LocalGitControlDirFormat
219
222
        return LocalGitControlDirFormat()
220
223
 
221
224
    def get_format_description(self):
222
225
        return "Git Working Tree"
223
226
 
 
227
    def initialize(self, a_bzrdir, revision_id=None, from_branch=None,
 
228
                   accelerator_tree=None, hardlink=False):
 
229
        """See WorkingTreeFormat.initialize()."""
 
230
        if not isinstance(a_bzrdir, LocalGitDir):
 
231
            raise errors.IncompatibleFormat(self, a_bzrdir)
 
232
        index = Index(a_bzrdir.root_transport.local_abspath(".git/index"))
 
233
        index.write()
 
234
        return GitWorkingTree(a_bzrdir, a_bzrdir.open_repository(),
 
235
            a_bzrdir.open_branch(), index)
 
236
 
224
237
 
225
238
class InterIndexGitTree(tree.InterTree):
226
239
    """InterTree that works between a Git revision tree and an index."""