/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 breezy/bzr/smart/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 23:15:15 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7183.
  • Revision ID: jelmer@jelmer.uk-20181116231515-zqd2yn6kj8lfydyp
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
        """Get the format that should be used when cloning from this dir.
185
185
 
186
186
        New in 1.13.
187
 
        
 
187
 
188
188
        :return: on success, a 3-tuple of network names for (control,
189
189
            repository, branch) directories, where '' signifies "not present".
190
190
            If this BzrDir contains a branch reference then this will fail with
209
209
        control_name = control_format.network_name()
210
210
        if not control_format.fixed_components:
211
211
            branch_name = (b'branch',
212
 
                control_format.get_branch_format().network_name())
 
212
                           control_format.get_branch_format().network_name())
213
213
            repository_name = control_format.repository_format.network_name()
214
214
        else:
215
215
            # Only MetaDir has delegated formats today.
216
216
            branch_name = (b'branch', b'')
217
217
            repository_name = b''
218
218
        return SuccessfulSmartServerResponse((control_name, repository_name,
219
 
            branch_name))
 
219
                                              branch_name))
220
220
 
221
221
 
222
222
class SmartServerBzrDirRequestCheckoutMetaDir(SmartServerRequestBzrDir):
284
284
        branch_format = result._format.network_name()
285
285
        repo_format = result.repository._format.network_name()
286
286
        repo_path = self._repo_relpath(bzrdir.root_transport,
287
 
            result.repository)
 
287
                                       result.repository)
288
288
        # branch format, repo relpath, rich_root, tree_ref, external_lookup,
289
289
        # repo_network_name
290
290
        return SuccessfulSmartServerResponse((b'ok', branch_format, repo_path,
291
 
            rich_root, tree_ref, external_lookup, repo_format))
 
291
                                              rich_root, tree_ref, external_lookup, repo_format))
292
292
 
293
293
 
294
294
class SmartServerRequestCreateRepository(SmartServerRequestBzrDir):
321
321
        rich_root, tree_ref, external_lookup = self._format_to_capabilities(
322
322
            result._format)
323
323
        return SuccessfulSmartServerResponse((b'ok', rich_root, tree_ref,
324
 
            external_lookup, result._format.network_name()))
 
324
                                              external_lookup, result._format.network_name()))
325
325
 
326
326
 
327
327
class SmartServerRequestFindRepository(SmartServerRequestBzrDir):
439
439
 
440
440
    def do_bzrdir_request(self):
441
441
        """Get the branches in a control directory.
442
 
        
 
442
 
443
443
        The body is a bencoded dictionary, with values similar to the return
444
444
        value of the open branch request.
445
445
        """
496
496
        return b'True'
497
497
 
498
498
    def do(self, bzrdir_network_name, path, use_existing_dir, create_prefix,
499
 
        force_new_repo, stacked_on, stack_on_pwd, repo_format_name,
500
 
        make_working_trees, shared_repo):
 
499
           force_new_repo, stacked_on, stack_on_pwd, repo_format_name,
 
500
           make_working_trees, shared_repo):
501
501
        """Initialize a bzrdir at path as per
502
502
        BzrDirFormat.initialize_on_transport_ex.
503
503
 
523
523
        repo_format_name = self.parse_NoneBytestring(repo_format_name)
524
524
        repo, bzrdir, stacking, repository_policy = \
525
525
            format.initialize_on_transport_ex(target_transport,
526
 
            use_existing_dir=use_existing_dir, create_prefix=create_prefix,
527
 
            force_new_repo=force_new_repo, stacked_on=stacked_on,
528
 
            stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
529
 
            make_working_trees=make_working_trees, shared_repo=shared_repo)
 
526
                                              use_existing_dir=use_existing_dir, create_prefix=create_prefix,
 
527
                                              force_new_repo=force_new_repo, stacked_on=stacked_on,
 
528
                                              stack_on_pwd=stack_on_pwd, repo_format_name=repo_format_name,
 
529
                                              make_working_trees=make_working_trees, shared_repo=shared_repo)
530
530
        if repo is None:
531
531
            repo_path = ''
532
532
            repo_name = b''
568
568
            final_stack_pwd = '.'
569
569
 
570
570
        return SuccessfulSmartServerResponse((repo_path.encode('utf-8'),
571
 
            rich_root, tree_ref, external_lookup, repo_name, repo_bzrdir_name,
572
 
            bzrdir._format.network_name(),
573
 
            self._serialize_NoneTrueFalse(stacking), final_stack.encode('utf-8'),
574
 
            final_stack_pwd.encode('utf-8'), repo_lock_token))
 
571
                                              rich_root, tree_ref, external_lookup, repo_name, repo_bzrdir_name,
 
572
                                              bzrdir._format.network_name(),
 
573
                                              self._serialize_NoneTrueFalse(
 
574
                                                  stacking), final_stack.encode('utf-8'),
 
575
                                              final_stack_pwd.encode('utf-8'), repo_lock_token))
575
576
 
576
577
 
577
578
class SmartServerRequestOpenBranch(SmartServerRequestBzrDir):
607
608
 
608
609
    def do_bzrdir_request(self):
609
610
        """Open a branch at path and return the reference or format.
610
 
        
 
611
 
611
612
        This version introduced in 2.1.
612
613
 
613
614
        Differences to SmartServerRequestOpenBranchV2:
634
635
                    detail = detail[2:]
635
636
                resp += (detail.encode('utf-8'),)
636
637
            return FailedSmartServerResponse(resp)
637