~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-08 11:01:15 UTC
  • mfrom: (6123.1.16 gpg-typo)
  • Revision ID: pqm@cupuasso-20110908110115-gbb9benwkdksvzk5
(jelmer) Fix a typo (invalid format identifier) in an error message in
 bzrlib.gpg. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    NoSuchRevision,
41
41
    SmartProtocolError,
42
42
    )
43
 
from bzrlib.i18n import gettext
44
43
from bzrlib.lockable_files import LockableFiles
45
44
from bzrlib.smart import client, vfs, repository as smart_repo
46
45
from bzrlib.smart.client import _SmartClient
487
486
        self._ensure_real()
488
487
        self._real_bzrdir.destroy_repository()
489
488
 
490
 
    def create_branch(self, name=None, repository=None,
491
 
                      append_revisions_only=None):
 
489
    def create_branch(self, name=None, repository=None):
492
490
        # as per meta1 formats - just delegate to the format object which may
493
491
        # be parameterised.
494
492
        real_branch = self._format.get_branch_format().initialize(self,
495
 
            name=name, repository=repository,
496
 
            append_revisions_only=append_revisions_only)
 
493
            name=name, repository=repository)
497
494
        if not isinstance(real_branch, RemoteBranch):
498
495
            if not isinstance(repository, RemoteRepository):
499
496
                raise AssertionError(
742
739
        self._supports_external_lookups = None
743
740
        self._supports_tree_reference = None
744
741
        self._supports_funky_characters = None
745
 
        self._supports_nesting_repositories = None
746
742
        self._rich_root_data = None
747
743
 
748
744
    def __repr__(self):
785
781
        return self._supports_funky_characters
786
782
 
787
783
    @property
788
 
    def supports_nesting_repositories(self):
789
 
        if self._supports_nesting_repositories is None:
790
 
            self._ensure_real()
791
 
            self._supports_nesting_repositories = \
792
 
                self._custom_format.supports_nesting_repositories
793
 
        return self._supports_nesting_repositories
794
 
 
795
 
    @property
796
784
    def supports_tree_reference(self):
797
785
        if self._supports_tree_reference is None:
798
786
            self._ensure_real()
1883
1871
        from bzrlib import osutils
1884
1872
        import tarfile
1885
1873
        # TODO: Maybe a progress bar while streaming the tarball?
1886
 
        note(gettext("Copying repository content as tarball..."))
 
1874
        note("Copying repository content as tarball...")
1887
1875
        tar_file = self._get_tarball('bz2')
1888
1876
        if tar_file is None:
1889
1877
            return None
2363
2351
        return a_bzrdir.open_branch(name=name, 
2364
2352
            ignore_fallbacks=ignore_fallbacks)
2365
2353
 
2366
 
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only):
 
2354
    def _vfs_initialize(self, a_bzrdir, name):
2367
2355
        # Initialisation when using a local bzrdir object, or a non-vfs init
2368
2356
        # method is not available on the server.
2369
2357
        # self._custom_format is always set - the start of initialize ensures
2371
2359
        if isinstance(a_bzrdir, RemoteBzrDir):
2372
2360
            a_bzrdir._ensure_real()
2373
2361
            result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
2374
 
                name, append_revisions_only=append_revisions_only)
 
2362
                name)
2375
2363
        else:
2376
2364
            # We assume the bzrdir is parameterised; it may not be.
2377
 
            result = self._custom_format.initialize(a_bzrdir, name,
2378
 
                append_revisions_only=append_revisions_only)
 
2365
            result = self._custom_format.initialize(a_bzrdir, name)
2379
2366
        if (isinstance(a_bzrdir, RemoteBzrDir) and
2380
2367
            not isinstance(result, RemoteBranch)):
2381
2368
            result = RemoteBranch(a_bzrdir, a_bzrdir.find_repository(), result,
2382
2369
                                  name=name)
2383
2370
        return result
2384
2371
 
2385
 
    def initialize(self, a_bzrdir, name=None, repository=None,
2386
 
                   append_revisions_only=None):
 
2372
    def initialize(self, a_bzrdir, name=None, repository=None):
2387
2373
        # 1) get the network name to use.
2388
2374
        if self._custom_format:
2389
2375
            network_name = self._custom_format.network_name()
2395
2381
            network_name = reference_format.network_name()
2396
2382
        # Being asked to create on a non RemoteBzrDir:
2397
2383
        if not isinstance(a_bzrdir, RemoteBzrDir):
2398
 
            return self._vfs_initialize(a_bzrdir, name=name,
2399
 
                append_revisions_only=append_revisions_only)
 
2384
            return self._vfs_initialize(a_bzrdir, name=name)
2400
2385
        medium = a_bzrdir._client._medium
2401
2386
        if medium._is_remote_before((1, 13)):
2402
 
            return self._vfs_initialize(a_bzrdir, name=name,
2403
 
                append_revisions_only=append_revisions_only)
 
2387
            return self._vfs_initialize(a_bzrdir, name=name)
2404
2388
        # Creating on a remote bzr dir.
2405
2389
        # 2) try direct creation via RPC
2406
2390
        path = a_bzrdir._path_for_remote_call(a_bzrdir._client)
2413
2397
        except errors.UnknownSmartMethod:
2414
2398
            # Fallback - use vfs methods
2415
2399
            medium._remember_remote_is_before((1, 13))
2416
 
            return self._vfs_initialize(a_bzrdir, name=name,
2417
 
                    append_revisions_only=append_revisions_only)
 
2400
            return self._vfs_initialize(a_bzrdir, name=name)
2418
2401
        if response[0] != 'ok':
2419
2402
            raise errors.UnexpectedSmartServerResponse(response)
2420
2403
        # Turn the response into a RemoteRepository object.
2441
2424
            remote_repo = RemoteRepository(repo_bzrdir, repo_format)
2442
2425
        remote_branch = RemoteBranch(a_bzrdir, remote_repo,
2443
2426
            format=format, setup_stacking=False, name=name)
2444
 
        if append_revisions_only:
2445
 
            remote_branch.set_append_revisions_only(append_revisions_only)
2446
2427
        # XXX: We know this is a new branch, so it must have revno 0, revid
2447
2428
        # NULL_REVISION. Creating the branch locked would make this be unable
2448
2429
        # to be wrong; here its simply very unlikely to be wrong. RBC 20090225
2643
2624
                self.bzrdir, self._client)
2644
2625
        return self._control_files
2645
2626
 
2646
 
    def _get_checkout_format(self, lightweight=False):
 
2627
    def _get_checkout_format(self):
2647
2628
        self._ensure_real()
2648
 
        if lightweight:
2649
 
            format = RemoteBzrDirFormat()
2650
 
            self.bzrdir._format._supply_sub_formats_to(format)
2651
 
            format.workingtree_format = self._real_branch._get_checkout_format(
2652
 
                lightweight=lightweight).workingtree_format
2653
 
            return format
2654
 
        else:
2655
 
            return self._real_branch._get_checkout_format(lightweight=False)
 
2629
        return self._real_branch._get_checkout_format()
2656
2630
 
2657
2631
    def get_physical_lock_status(self):
2658
2632
        """See Branch.get_physical_lock_status()."""