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

  • Committer: Jelmer Vernooij
  • Date: 2009-07-22 13:10:44 UTC
  • mfrom: (0.200.588 trunk)
  • mto: (0.200.597 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090722131044-r30g8w06xd8f40fl
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""An adapter between a Git control dir and a Bazaar BzrDir."""
18
18
 
19
 
import os
20
 
 
21
 
import bzrlib
22
19
from bzrlib import (
23
20
    bzrdir,
24
21
    lockable_files,
120
117
        return self._gitrepository_class(self, self._lockfiles)
121
118
 
122
119
    def open_workingtree(self, recommend_upgrade=True):
123
 
        if (not self._git.bare and 
124
 
            os.path.exists(os.path.join(self._git.controldir(), "index"))):
 
120
        if not self._git.bare and self._git.has_index():
125
121
            return workingtree.GitWorkingTree(self, self.open_repository(), 
126
122
                                                  self.open_branch())
127
123
        loc = urlutils.unescape_for_display(self.root_transport.base, 'ascii')
132
128
 
133
129
    def create_branch(self):
134
130
        return self.open_branch()
 
131
 
 
132
    def backup_bzrdir(self):
 
133
        if self._git.bare:
 
134
            self.root_transport.copy_tree(".git", ".git.backup")
 
135
            return (self.root_transport.abspath(".git"),
 
136
                    self.root_transport.abspath(".git.backup"))
 
137
        else:
 
138
            raise errors.bzr_errors.BzrError("Unable to backup bare repositories")
 
139
 
 
140
    def create_workingtree(self, revision_id=None, from_branch=None,
 
141
        accelerator_tree=None, hardlink=False):
 
142
        if self._git.bare:
 
143
            raise errors.bzr_errors.BzrError("Can't create working tree in a bare repo")
 
144
        from dulwich.index import write_index
 
145
        write_index(self.root_transport.abspath(".git/index"), [])
 
146
        return self.open_workingtree()