13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
16
"""Foreign branch utilities."""
21
18
from bzrlib.branch import Branch
22
19
from bzrlib.commands import Command, Option
23
from bzrlib.repository import Repository
24
20
from bzrlib.revision import Revision
25
21
from bzrlib.lazy_import import lazy_import
26
22
lazy_import(globals(), """
27
23
from bzrlib import (
181
176
foreign_vcs_registry = ForeignVcsRegistry()
184
class ForeignRepository(Repository):
185
"""A Repository that exists in a foreign version control system.
187
The data in this repository can not be represented natively using
188
Bazaars internal datastructures, but have to converted using a VcsMapping.
191
# This repository's native version control system
194
def has_foreign_revision(self, foreign_revid):
195
"""Check whether the specified foreign revision is present.
197
:param foreign_revid: A foreign revision id, in the format used
198
by this Repository's VCS.
200
raise NotImplementedError(self.has_foreign_revision)
202
def lookup_bzr_revision_id(self, revid):
203
"""Lookup a mapped or roundtripped revision by revision id.
205
:param revid: Bazaar revision id
206
:return: Tuple with foreign revision id and mapping.
208
raise NotImplementedError(self.lookup_revision_id)
210
def all_revision_ids(self, mapping=None):
211
"""See Repository.all_revision_ids()."""
212
raise NotImplementedError(self.all_revision_ids)
214
def get_default_mapping(self):
215
"""Get the default mapping for this repository."""
216
raise NotImplementedError(self.get_default_mapping)
218
def get_inventory_xml(self, revision_id):
219
"""See Repository.get_inventory_xml()."""
220
return self.serialise_inventory(self.get_inventory(revision_id))
222
def get_inventory_sha1(self, revision_id):
223
"""Get the sha1 for the XML representation of an inventory.
225
:param revision_id: Revision id of the inventory for which to return
230
return osutils.sha_string(self.get_inventory_xml(revision_id))
232
def get_revision_xml(self, revision_id):
233
"""Return the XML representation of a revision.
235
:param revision_id: Revision for which to return the XML.
238
return self._serializer.write_revision_to_string(
239
self.get_revision(revision_id))