/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 bzrlib/foreign.py

  • Committer: Andrew Bennetts
  • Date: 2009-10-21 11:13:40 UTC
  • mto: This revision was merged to the branch mainline in revision 4762.
  • Revision ID: andrew.bennetts@canonical.com-20091021111340-w7x4d5yf83qwjncc
Add test that WSGI glue allows request handlers to access paths above that request's. backing transport, so long as it is within the WSGI app's backing transport.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
124
124
 
125
125
    branch_format = None
126
126
 
127
 
    repository_format = None
128
 
 
129
127
    def __init__(self, mapping_registry, abbreviation=None):
130
128
        """Create a new foreign vcs instance.
131
129
 
225
223
        """Get the default mapping for this repository."""
226
224
        raise NotImplementedError(self.get_default_mapping)
227
225
 
 
226
    def get_inventory_xml(self, revision_id):
 
227
        """See Repository.get_inventory_xml()."""
 
228
        return self.serialise_inventory(self.get_inventory(revision_id))
 
229
 
 
230
    def get_inventory_sha1(self, revision_id):
 
231
        """Get the sha1 for the XML representation of an inventory.
 
232
 
 
233
        :param revision_id: Revision id of the inventory for which to return
 
234
         the SHA1.
 
235
        :return: XML string
 
236
        """
 
237
 
 
238
        return osutils.sha_string(self.get_inventory_xml(revision_id))
 
239
 
 
240
    def get_revision_xml(self, revision_id):
 
241
        """Return the XML representation of a revision.
 
242
 
 
243
        :param revision_id: Revision for which to return the XML.
 
244
        :return: XML string
 
245
        """
 
246
        return self._serializer.write_revision_to_string(
 
247
            self.get_revision(revision_id))
 
248
 
228
249
 
229
250
class ForeignBranch(Branch):
230
251
    """Branch that exists in a foreign version control system."""
259
280
 
260
281
 
261
282
class cmd_dpush(Command):
262
 
    __doc__ = """Push into a different VCS without any custom bzr metadata.
 
283
    """Push into a different VCS without any custom bzr metadata.
263
284
 
264
285
    This will afterwards rebase the local branch on the remote
265
286
    branch unless the --no-rebase option is used, in which case 
296
317
        except NoWorkingTree:
297
318
            source_branch = Branch.open(directory)
298
319
            source_wt = None
299
 
        if source_wt is not None:
300
 
            source_wt.check_changed_or_out_of_date(
301
 
                strict, 'dpush_strict',
302
 
                more_error='Use --no-strict to force the push.',
303
 
                more_warning='Uncommitted changes will not be pushed.')
 
320
        if strict is None:
 
321
            strict = source_branch.get_config(
 
322
                ).get_user_option_as_bool('dpush_strict')
 
323
        if strict is None: strict = True # default value
 
324
        if strict and source_wt is not None:
 
325
            if (source_wt.has_changes()):
 
326
                raise errors.UncommittedChanges(
 
327
                    source_wt, more='Use --no-strict to force the push.')
 
328
            if source_wt.last_revision() != source_wt.branch.last_revision():
 
329
                # The tree has lost sync with its branch, there is little
 
330
                # chance that the user is aware of it but he can still force
 
331
                # the push with --no-strict
 
332
                raise errors.OutOfDateTree(
 
333
                    source_wt, more='Use --no-strict to force the push.')
304
334
        stored_loc = source_branch.get_push_location()
305
335
        if location is None:
306
336
            if stored_loc is None: