~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-12 18:40:02 UTC
  • mfrom: (6132 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6133.
  • Revision ID: john@arbash-meinel.com-20110912184002-o23eu21fdgp35h2q
Merge bzr.dev, resolve release-notes (aka NEWS) conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
486
486
        self._ensure_real()
487
487
        self._real_bzrdir.destroy_repository()
488
488
 
489
 
    def create_branch(self, name=None, repository=None):
 
489
    def create_branch(self, name=None, repository=None,
 
490
                      append_revisions_only=None):
490
491
        # as per meta1 formats - just delegate to the format object which may
491
492
        # be parameterised.
492
493
        real_branch = self._format.get_branch_format().initialize(self,
493
 
            name=name, repository=repository)
 
494
            name=name, repository=repository,
 
495
            append_revisions_only=append_revisions_only)
494
496
        if not isinstance(real_branch, RemoteBranch):
495
497
            if not isinstance(repository, RemoteRepository):
496
498
                raise AssertionError(
1509
1511
        # We need to accumulate additional repositories here, to pass them in
1510
1512
        # on various RPC's.
1511
1513
        #
 
1514
        # Make the check before we lock: this raises an exception.
 
1515
        self._check_fallback_repository(repository)
1512
1516
        if self.is_locked():
1513
1517
            # We will call fallback.unlock() when we transition to the unlocked
1514
1518
            # state, so always add a lock here. If a caller passes us a locked
1515
1519
            # repository, they are responsible for unlocking it later.
1516
1520
            repository.lock_read()
1517
 
        self._check_fallback_repository(repository)
1518
1521
        self._fallback_repositories.append(repository)
1519
1522
        # If self._real_repository was parameterised already (e.g. because a
1520
1523
        # _real_branch had its get_stacked_on_url method called), then the
2350
2353
        return a_bzrdir.open_branch(name=name, 
2351
2354
            ignore_fallbacks=ignore_fallbacks)
2352
2355
 
2353
 
    def _vfs_initialize(self, a_bzrdir, name):
 
2356
    def _vfs_initialize(self, a_bzrdir, name, append_revisions_only):
2354
2357
        # Initialisation when using a local bzrdir object, or a non-vfs init
2355
2358
        # method is not available on the server.
2356
2359
        # self._custom_format is always set - the start of initialize ensures
2358
2361
        if isinstance(a_bzrdir, RemoteBzrDir):
2359
2362
            a_bzrdir._ensure_real()
2360
2363
            result = self._custom_format.initialize(a_bzrdir._real_bzrdir,
2361
 
                name)
 
2364
                name, append_revisions_only=append_revisions_only)
2362
2365
        else:
2363
2366
            # We assume the bzrdir is parameterised; it may not be.
2364
 
            result = self._custom_format.initialize(a_bzrdir, name)
 
2367
            result = self._custom_format.initialize(a_bzrdir, name,
 
2368
                append_revisions_only=append_revisions_only)
2365
2369
        if (isinstance(a_bzrdir, RemoteBzrDir) and
2366
2370
            not isinstance(result, RemoteBranch)):
2367
2371
            result = RemoteBranch(a_bzrdir, a_bzrdir.find_repository(), result,
2368
2372
                                  name=name)
2369
2373
        return result
2370
2374
 
2371
 
    def initialize(self, a_bzrdir, name=None, repository=None):
 
2375
    def initialize(self, a_bzrdir, name=None, repository=None,
 
2376
                   append_revisions_only=None):
2372
2377
        # 1) get the network name to use.
2373
2378
        if self._custom_format:
2374
2379
            network_name = self._custom_format.network_name()
2380
2385
            network_name = reference_format.network_name()
2381
2386
        # Being asked to create on a non RemoteBzrDir:
2382
2387
        if not isinstance(a_bzrdir, RemoteBzrDir):
2383
 
            return self._vfs_initialize(a_bzrdir, name=name)
 
2388
            return self._vfs_initialize(a_bzrdir, name=name,
 
2389
                append_revisions_only=append_revisions_only)
2384
2390
        medium = a_bzrdir._client._medium
2385
2391
        if medium._is_remote_before((1, 13)):
2386
 
            return self._vfs_initialize(a_bzrdir, name=name)
 
2392
            return self._vfs_initialize(a_bzrdir, name=name,
 
2393
                append_revisions_only=append_revisions_only)
2387
2394
        # Creating on a remote bzr dir.
2388
2395
        # 2) try direct creation via RPC
2389
2396
        path = a_bzrdir._path_for_remote_call(a_bzrdir._client)
2396
2403
        except errors.UnknownSmartMethod:
2397
2404
            # Fallback - use vfs methods
2398
2405
            medium._remember_remote_is_before((1, 13))
2399
 
            return self._vfs_initialize(a_bzrdir, name=name)
 
2406
            return self._vfs_initialize(a_bzrdir, name=name,
 
2407
                    append_revisions_only=append_revisions_only)
2400
2408
        if response[0] != 'ok':
2401
2409
            raise errors.UnexpectedSmartServerResponse(response)
2402
2410
        # Turn the response into a RemoteRepository object.
2423
2431
            remote_repo = RemoteRepository(repo_bzrdir, repo_format)
2424
2432
        remote_branch = RemoteBranch(a_bzrdir, remote_repo,
2425
2433
            format=format, setup_stacking=False, name=name)
 
2434
        if append_revisions_only:
 
2435
            remote_branch.set_append_revisions_only(append_revisions_only)
2426
2436
        # XXX: We know this is a new branch, so it must have revno 0, revid
2427
2437
        # NULL_REVISION. Creating the branch locked would make this be unable
2428
2438
        # to be wrong; here its simply very unlikely to be wrong. RBC 20090225
2623
2633
                self.bzrdir, self._client)
2624
2634
        return self._control_files
2625
2635
 
2626
 
    def _get_checkout_format(self):
 
2636
    def _get_checkout_format(self, lightweight=False):
2627
2637
        self._ensure_real()
2628
 
        return self._real_branch._get_checkout_format()
 
2638
        if lightweight:
 
2639
            format = RemoteBzrDirFormat()
 
2640
            self.bzrdir._format._supply_sub_formats_to(format)
 
2641
            format.workingtree_format = self._real_branch._get_checkout_format(
 
2642
                lightweight=lightweight).workingtree_format
 
2643
            return format
 
2644
        else:
 
2645
            return self._real_branch._get_checkout_format(lightweight=False)
2629
2646
 
2630
2647
    def get_physical_lock_status(self):
2631
2648
        """See Branch.get_physical_lock_status()."""