Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4333730
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:25:58+00:00 2026-05-21T10:25:58+00:00

I have a working directory in trunk and would like to switch it to

  • 0

I have a working directory in trunk and would like to switch it to a specified branch. How can I do that?

I’d like to have a method

public static void switchToBranch(File baseDir, String branchUrl){
}

How could I implement that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:25:58+00:00Added an answer on May 21, 2026 at 10:25 am

    [Update] Better version:

    public static void switchToBranch(final String branchUrl,
        final File basedir,
        final ISVNDebugLog log) throws SVNException, IOException{
        final SVNUpdateClient updateClient =
            SVNClientManager
                .newInstance().getUpdateClient();
        if(log != null) updateClient.setDebugLog(log);
        updateClient.doSwitch(basedir,
            SVNURL.parseURIEncoded(branchUrl),
            SVNRevision.HEAD,
            SVNRevision.HEAD,
            SVNDepth.INFINITY,
            false,
            false);
    }
    

    Credentials are apparently automatically picked up from the ~/.subversion directory.

    (And of course it doesn’t have to be a branch, SVN doesn’t make a difference between tags, branches or any other path)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working a project that does not have a trunk / branches /
I have created a branch like this svn copy svn+ssh://foo.bar/svn/myproject/trunk svn+ssh://foo.bar/svn/myproject/branches/feature-x I then proceeded
I have a git working directory and have added to .git/objects/info/alternates so that this
I have a git repository (and working directory) that is stored in my Dropbox
I have been working with a string[] array in C# that gets returned from
I have been working on some legacy C++ code that uses variable length structures
I may have found a Subversion bug, and I would like to make sure
I have an application that I am working on modifying and I am having
When I have: dirty working directory, dirty staging area, and I copied some new
I have a branch checkout that is clean (no modifications), but I cannot reintegrate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.