~ubuntu-branches/ubuntu/saucy/bzr-svn/saucy

« back to all changes in this revision

Viewing changes to remote.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-03-06 01:55:20 UTC
  • mfrom: (3.3.13 sid)
  • Revision ID: package-import@ubuntu.com-20120306015520-grugcrw9ju4a0qsm
Tags: 1.2.1-1
* Fix format string of copyright file.
* Bump standards version to 3.9.3.
* Add basic tests for autopkgtest.
* New upstream release.
 + Fixes tests against newer versions of bzr. Closes: #660730

Show diffs side-by-side

added added

removed removed

Lines of Context:
427
427
                inter = InterToSvnRepository(source.repository, repos)
428
428
                layout = repos.get_layout()
429
429
                try:
430
 
                    (type, project, _, ip) = layout.parse(target_branch_path)
 
430
                    project = layout.get_branch_project(target_branch_path)
431
431
                except NotSvnBranchPath:
432
432
                    raise errors.NotBranchError(target_branch_path)
433
 
                if type not in ('branch', 'tag') or ip != '':
434
 
                    raise errors.NotBranchError(target_branch_path)
435
433
                inter.push_new_branch(layout, project, target_branch_path,
436
434
                        stop_revision, push_metadata=True, overwrite=overwrite)
437
435
                return self.open_branch(name)
474
472
            if mapping is None:
475
473
                mapping = repository.get_mapping()
476
474
 
 
475
            if name is not None and "/" in name:
 
476
                raise errors.InvalidBranchName(name)
477
477
            relpath = self._determine_relpath(name).strip("/")
478
478
            if relpath == "":
479
479
                if repository.get_latest_revnum() > 0:
486
486
            if len(existing_bp_parts) == len(bp_parts) and relpath != "":
487
487
                raise errors.AlreadyBranchError(repository.transport.base)
488
488
            if len(existing_bp_parts) < len(bp_parts)-1:
489
 
                create_branch_container(repository.transport, relpath, "/".join(existing_bp_parts))
 
489
                create_branch_container(repository.transport, relpath,
 
490
                    "/".join(existing_bp_parts))
490
491
            if relpath != "":
491
 
                create_branch_with_hidden_commit(repository, relpath, NULL_REVISION,
492
 
                        set_metadata=(not lossy))
 
492
                create_branch_with_hidden_commit(repository, relpath,
 
493
                    NULL_REVISION, set_metadata=(not lossy))
493
494
            branch = SvnBranch(repository, self, relpath, mapping)
494
495
            if append_revisions_only == False:
495
496
                branch.set_append_revisions_only(False)
511
512
 
512
513
    def open_branch(self, name=None, unsupported=True, ignore_fallbacks=False,
513
514
            mapping=None, branch_path=None, repository=None, revnum=None,
514
 
            possible_transports=None):
 
515
            possible_transports=None, project=None):
515
516
        """See ControlDir.open_branch()."""
516
517
        from bzrlib.plugins.svn.branch import SvnBranch
517
518
        if branch_path is None:
520
521
            repository = self.find_repository()
521
522
        if mapping is None:
522
523
            mapping = repository.get_mapping()
523
 
        return SvnBranch(repository, self, branch_path, mapping, revnum=revnum)
 
524
        return SvnBranch(repository, self, branch_path, mapping, revnum=revnum,
 
525
            project=project)
524
526
 
525
527
    def create_repository(self, shared=None, format=None):
526
528
        """See ControlDir.create_repository."""
566
568
        return ret
567
569
 
568
570
    def destroy_branch(self, branch_name=None):
 
571
        import subvertpy
569
572
        relpath = self._determine_relpath(branch_name)
570
573
        if relpath == "":
571
574
            raise errors.UnsupportedOperation(self.destroy_branch, self)
575
578
            ce = conn.get_commit_editor({"svn:log": "Remove branch."})
576
579
            try:
577
580
                root = ce.open_root()
578
 
                root.delete_entry(basename)
 
581
                try:
 
582
                    root.delete_entry(basename)
 
583
                except subvertpy.SubversionException, (_, num):
 
584
                    if num == subvertpy.ERR_FS_TXN_OUT_OF_DATE:
 
585
                        # Make sure the branch still exists
 
586
                        self.open_branch(branch_name)
 
587
                    raise
579
588
                root.close()
580
589
            except:
581
590
                ce.abort()
606
615
        branches = {}
607
616
        for project, bp, nick, has_props, revnum in layout.get_branches(repos,
608
617
                repos.get_latest_revnum()):
609
 
            b = self.open_branch(branch_path=bp, repository=repos)
 
618
            b = self.open_branch(branch_path=bp, repository=repos,
 
619
                project=project)
610
620
            branches[b.name] = b
611
621
        return branches
612
622