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

so from what i can tell, you have to specify artifacts and working directory
I have been working on a branch for a while, and deleted a directory
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 am working a project that does not have a trunk / branches /
The Issue: when multiple users have access to the same working directory, permissions issues
I have been working on a recursive directory scan which scans folders and adds
I have code which as been working against an older Active Directory server and
I have in the directory /config/initializers/constants_data.rb following line: ADM = User.find_by_name('admin').id This is working
I have working registration script the only problem is that i do not know
I have an SVN project with a branch I'm working on, and an empty

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.