Repository Upgrade FAQ

Cory Johns

How do I migrate commits made to my old repository after the upgrade?

If your old repository was not set read-only and there were commits made to it after your project were upgraded, you will need to bring those commits over to the new repository. With git and Mercurial, it is relatively straightforward to push the commits to the new repository. Just pull all the commits from the old repo, change your origin / default path (see below), and push the commits to the new repo.

For SVN, it is more complicated. If there are no new commits on the new repository, you can just use the Import Repo tool on the Admin page of the project to reimport the repository. If the repos are diverged, you will need to merge the changes into the new repo:

svn merge -r<last-common-revision>:HEAD <old-repo-url>

How do I change git to point to the new repo?

If you have a newer version of git, you can use set-url:

git remote set-url origin <new-repo-url>

If your version of git doesn't support set-url, you'll need to remove and re-add the origin remote:

git remote rm origin
git remote add origin <new-repo-url>

You can also just edit the .git/config file and change the URL there.

How do I change Mercurial to point to the new repo?

Just edit the hgrc file in .hg/hgrc and change the URL for default in the [paths] section.

How do I change SVN to point to the new repo?

Newer versions of SVN can use the relocate command:

svn relocate <new-repo-url>

Older versions will need to use switch instead:

svn switch --relocate <old-repo-url> <new-repo-url>

You can get the old repo URL from the info command:

svn info

Note that the URL paths need to match, that is, if your old URL ends in /trunk, the new one must as well, and vice-versa. If not, you may get the error:

svn: Can't find entry

I need more help!

Contact SourceForge Support and we'll do what we can to help.


Discussion

<< < 1 2 (Page 2 of 2)
  • Dirk Bauer
    Dirk Bauer
    2013-06-13

    How do I change SVN to point to the new repo?
    Newer versions of SVN can use the relocate command:
    svn relocate <new-repo-url>

    Hi, I try to relocate my project using Tortoise SVN "Relocate..." command.
    The problem is, in your "Code Repo Complete" mail regarding my project you wrote

    Old repository url: http://seb.svn.sourceforge.net/svnroot/seb

    but did not tell me the NEW repository URL, which is exactly what I need to enter
    in the Tortoise SVN Relocate input window. [You only told me a Checkout command line but Checkout is something different from Relocate].

    I tried to figure out what the new repository URL is. My project page indicates it is

    https://sourceforge.net/p/seb/svn/HEAD/tree/

    But this has a different ending ("tree/") than the old URL ("seb"), in contradiction
    to your statement

    Note that the URL paths need to match, that is, if your old URL ends in /trunk, the >new one must as well, and vice-versa.

    And when I enter this new repository URL into Tortoise SVN Relocate,
    I get the error message

    Repository moved temporarily to 'http://sourceforge.net/p/seb/svn/HEAD/tree/'; please relocate

    which is exactly what I wanted to do... so can't you just give the users the old and new repository URLs so that it's clear how to migrate their projects?

     
    • Dave Brondsema
      Dave Brondsema
      2013-06-13

      The new URL is shown on the new webpage in the text box that has the "svn checkout" command. So for seb, it is https://svn.code.sf.net/p/seb/svn/trunk/

       
      • Dirk Bauer
        Dirk Bauer
        2013-06-17

        Hi Dave,

        many thanks! I did this, just made a Tortoise SVN Relocate

        from old repository
        https://svn.code.sf.net/p/seb/svn

        to new repository
        http://seb.svn.sourceforge.net/viewvc/seb/

        (because I wanted to relocate not only /trunk but also /branches and /tags,
        the same way I used SVN before the relocation) and it worked fine!

        Regards,
        Dirk

         
  • Rich Levinson
    Rich Levinson
    2013-06-20

    Hi, I am trying to upgrade my project(s) to use the new repository.

    Based on the following 3 pieces of information:

    1. email from sourceforge: 4/29/2013 5:06PM
      Subject: Sourceforge Project Upgrade - Code Repo Complete,
      it says:

      "New repository checkout command: svn checkout --username=USERNAME
       svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code/ openaz-code"
      

      Since I am not doing a checkout, I am just using the above cmd for ref.
      I also have substituted "username" for my real username that
      appeared in the cmd in the email above.

    2. When I tried to do an operation on my repository (w/o yet doing the
      upgrade, I got a dialog box error that said:

      "   Please update your configuration with the following command:
         svn relocate "svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code/" "
      

      Note: I am assuming the quotes after the "relocate" cmd, around what
      is presumably the new URL, are required.

    3. I read this FAQ where the instruction is:

      "   Newer versions of SVN can use the relocate command:
      svn relocate <new-repo-url>"
      

      When I did svn help, I found I am using version 1.7.8 of the
      command line client, and there was a "relocate" command on
      the list, so I figured this was a "newer version" where
      I could use the relocate command.

    Combining the 3 items of information above, I concluded that the
    command that I should enter to do the upgrade is:

     svn relocate "svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code/"
    

    where, of course, I substituted my real username, which I also used
    to login to enter this report to the wiki.

    Unfortunately, the command above does not appear to work, as I get the
    error:

    svn: E155024: Invalid relocation destination:
    'svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code'
    (does not point to target)

    where again, I have replaced my real username w the all-caps string.

    Any suggestions would be appreciated as I have been putting this off
    and now really need to get going.

    Thanks,
    Rich

     
    • Chris Tsai
      Chris Tsai
      2013-06-20

      Please submit a support ticket for this, and include the actual commands you're running (without substitutions). https://sourceforge.net/p/forge/site-support/new/

       
      • Rich Levinson
        Rich Levinson
        2013-07-11

        Hi Chris and other interested parties,

        SUGGESTION FROM CHRIS THAT WORKED ON WINDOWS

        After submitting support ticket #4472, Chris gave me a suggestion that appears
        to work. Basically, to use a different format than ssh+svn:

        Windows can be finicky when setting up svn+ssh, but we have put together
         some guides to assist with that. There's a TortoiseSVN guide
         (http://sourceforge.net/p/forge/community-docs/TortoiseSVN),
         and a command line SVN guide
         (http://sourceforge.net/p/forge/community-docs/SVN%20on%20Windows/).
        
        Alternatively, you could use https, which generally doesn't require
         additional setup
         (though in our testing, we've found svn+ssh to perform better):
         eg. https://svn.code.sf.net/p/openaz/code/
        

        The original recommendation in the error message and the email was to submit
        a command that looked like this: (DID NOT WORK ON WINDOWS)
        svn relocate "svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code
        I could not get the above to work under any circumstances that I tried.

        However, when I tried the form: (DID WORK ON WINDOWS):
        svn relocate https://svn.code.sf.net/p/openaz/code
        (i.e. replace svn+ssh://USERNAME@ with https:// and remove quotes)
        things started to work.

        There is one more thing to explain:
        The svn relocate command applies to the local project, for example,
        I use TortoiseSVN and there is a complete directory for a branch
        in my local machine. I have different projects locally for different
        branches on the site.

        Therefore, I needed to do specific svn relocate commands for each
        project, identifying the branch in the cmd. So, I never actually used
        the command above as written, but always with a branch suffix.

        For example:

        For my trunk project the command was:

        svn relocate https://svn.code.sf.net/p/openaz/code/trunk
        

        For projects on the branches an example would be:

        svn relocate https://svn.code.sf.net/p/openaz/code/branches/RB-1.0
        

        i.e. append the top of project suffix as it appears in the
        repository path to the root path that ends in "/code".

        Final note: I find the URLs very confusing. For example, when
        I actually go to the repository, say for RB-1.0 to browse, then
        the URL appears to be:
        https://sourceforge.net/p/openaz/code/HEAD/tree/branches/RB-1.0/

        which is quite different from (the URL used in the relocate cmd above):
        https://svn.code.sf.net/p/openaz/code/branches/RB-1.0

        There are also other path-like things on the page above, such as:
        Home / Browse / Projects / OpenAz / Code /
        and
        Tree [r162] / branches / RB-1.0 /

        along w a scary dialog box containing:
        svn checkout --username=USERNAME
        svn+ssh://USERNAME@svn.code.sf.net/p/openaz/code/ openaz-code

        I have no idea what any of those are for, so my message from this
        experience is if you are having trouble on windows, you might
        want to try Chris' suggestion to use a root path of:
        https://svn.code.sf.net/p/PROJECTNAME/code

        and remember if you are using branches to append the
        extension to the top of the branch: (eg. /trunk or
        /branches/RB-1.0 etc.)

        Thanks,
        Rich

         
  • The constant asking for passwords is not just a Tortoise svn problem. I'm having the same troubles with svn on console in debian with the new repositories (sometimes asking even several times for a password while doing a single update). Guess I'll try if I can figure out how to create an ssh key for that on Linux. It would be nice if you could post an instruction guide for that.

     
  • OK, seems I already have uploaded an ssh-key in the past. So just to be sure I'm not doing now lots of unnecessary work - what I seem to have to do to avoid having to enter passwords constantly is:

    1. Figure out which is the private ssh key which I used for the public key I uploaded to sourceforge in the past and where it is saved - or create another new key and upload that to my account.
    2. copy that private key to all systems I use for development.
    3. setup ssh-agent on the Linux systems and add that private key to them.
    4. figure out how to start ssh-agent now on each system on boot (probably not the same way on each Linux)
    5. Install pageant on my Windows systems and do the same stuff there - add private key and then setup pageant to start on boot.

    Does this sound correct? Btw, just wondering - why ssh at all when the sources I send are open-source anyway? :-) Because it really is somewhat painful when you are working with a lot of systems (especially the scripts I'm finding to setup ssh-agent look rather scary). And having lots of systems is unfortunately necessary when you want to support a few platforms. Which again is not such an uncommmon thing to do for free software. So I kinda preferred the old way really ...

     
  • Ok, after experimenting a few evenings I got a solution which seems to work on Linux. Just in case others needs this as well:

    Create at least one ssh-key and upload it to sf as described here:
    https://sourceforge.net/apps/trac/sourceforge/wiki/SSH%20keys

    I guess it doesn't matter if you create one per system or copy your keys to each system where you want to access svn, but I prefer creating one key per computer.

    You have the choice of creating a ssh-key with or without password. Not using a password here is a little simpler (but certainly less secure) - so I'm doing that.

    And now you can modify the file .ssh/config (in my case I had to create it first) and add something like the following (where you_private_key is certainly the path to the key you created above):

    Host svn.code.sf.net
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/you_private_key
    

    Now each time you use svn from host svn.code.sf.net it will automatically use your ssh-key instead of asking for the sourceforge password constantly.

    Figuring out a good Windows solution coming next ;-)

     
  • Franck HECHT
    Franck HECHT
    2013-07-12

    It works thanks to the explanations above for Windows, thank you!

     
    Last edit: Franck HECHT 2013-07-12
  • I just upgraded my eclipse svn project using totoisesvn (would not work from command line). Eclipse (using latest subclipse 1.10 plugin) is freaking out -- any attempt to do anything with the repo fails with a message like.....

    Problems reported while synchronizing SVNStatusSubscriber. 0 of 1 resources were synchronized.
    An error occurred synchronizing /gumbo.model: Error getting status for resource P/gumbo.model org.apache.subversion.javahl.ClientException: Can't create tunnel
    svn: Unable to connect to a repository at URL 'svn+ssh://jonbarril@svn.code.sf.net/p/gumbo/svn/gumbo.model'
    The system cannot find the file specified.
    svn: Can't create tunnel: The system cannot find the file specified.

    Error getting status for resource P/gumbo.model org.apache.subversion.javahl.ClientException: Can't create tunnel
    svn: Unable to connect to a repository at URL 'svn+ssh://jonbarril@svn.code.sf.net/p/gumbo/svn/gumbo.model'
    The system cannot find the file specified.
    svn: Can't create tunnel: The system cannot find the file specified.

    org.apache.subversion.javahl.ClientException: Can't create tunnel
    svn: Unable to connect to a repository at URL 'svn+ssh://jonbarril@svn.code.sf.net/p/gumbo/svn/gumbo.model'
    The system cannot find the file specified.
    svn: Can't create tunnel: The system cannot find the file specified.

    org.apache.subversion.javahl.ClientException: Can't create tunnel
    svn: Unable to connect to a repository at URL 'svn+ssh://jonbarril@svn.code.sf.net/p/gumbo/svn/gumbo.model'
    The system cannot find the file specified.
    svn: Can't create tunnel: The system cannot find the file specified.

     
<< < 1 2 (Page 2 of 2)