Working offline with SVN on local machine temporary

19,091

Solution 1

Your problem sounds to me like the use case for git-svn:

  • set up your Git repo: git svn clone http://svn.example.com/project/trunk
  • while being online, commit your changes to SVN
  • before going offline, do a git svn rebase to get your Git repo in sync with the SVN repo
  • while being offline, commit to the Git repo using git commit
  • when getting back online again, do a git svn dcommit to push your changes back to the SVN repo

I'm using this workflow daily!

You get two huge advantages doing so:

  • your complete SVN history is backed up in the Git repo and in every Git repo that gets cloned from that one
  • while being offline, you can view the commit messages, checkout other branches, etc.

Solution 2

Ridiculous answer would be to migrate to another versioning tool, no offence!

I had the exact issue.
Been using SVN on my "real" server where the "real" repository is.
When I went out with my laptop, without internet I would simply duplicate the "real" repository on this laptop (VisualSVN + TortoiseSVN), work on it, change/commit whatever, and when come back simply "sync" the new 'revision' files to the "real" repository.

To be a bit more clear: Have two SVN servers, one locally on your laptop (the clone) and one on your "real" server (obviously). Just sync between the two.

Solution 3

You can access svn repositories with mercurial.

Solution 4

I've been using git on a project that uses SVN for the same reason you describe above. There is some getting used to git/mercurial but after a while I really like the new approach. Further I never had any issues with using git-svn, never have tried mercurial and svn..

If you are onto Mercurial and are still looking for a good tutorial with one or two chuckles in between check out this tutorial written by Joel Spolsky. And as mentioned before, surely is a great opportunity to get started with DVCS.

Solution 5

Disclaimer: I'm the author of SOS (SVN Offline Support).

I wrote this easy to use command-line tool to solve exactly the problem of working with SVN offline, but it works not only within SVN checkouts, but for any VCS working copy (e.g. Bazaar, Git, fossil), or even in untracked file trees. SOS allows simple commits, branching, switch/update operations, without all the complex semantic background knowledge required by traditional VCS. After coming back online, you can integrate all changes back to your underlying VCS.

Website

Installation requires Python 3, and is handled via pip install -U sos-vcs

Update

While I still use SOS it daily, the code became an unmaintainable mess requiring a major rewrite. The idea is still valid and may serve as inspiration for similar projects.

Share:
19,091
Karan
Author by

Karan

Twitter: @karangb Engineer at Facebook 1st class MEng in Computer Science at Imperial College London.

Updated on June 17, 2022

Comments

  • Karan
    Karan almost 2 years

    I am working on a project currently on SVN. I however will not have access to the internet for a few days, and will be working on my project.

    Is there any way to make a clone of the repository on my local machine, commit changes to it, and when I gain access to the internet "push" them onto the shared repository? Thinking in terms of Mercurial here, is it worth migrating completely?!

  • Rudi
    Rudi over 13 years
    This works only as long as on any point in time only one server receives new changesets. This scheme breaks if at the same time when you are offline and commit changes to your clone, someone commits changes to the same paths in the original repo.
  • Karan
    Karan about 12 years
    how do you sync two svn clones? As @Rudi said, what if somone else commits to the original repo?
  • Poni
    Poni about 12 years
    My approach assumes you're the sole committer. Otherwise it could break as Rudi suggests.
  • Poni
    Poni about 12 years
    ... and I sync the two svn clones by copying files, simply.
  • sleske
    sleske about 12 years
    +1 Yes, this is exactly what git-svn was made for. I started using git for this exact reason, and it works great.
  • sleske
    sleske about 12 years
    That sounds like dangerous advice. You are essentially (badly) reimplementing a DVCS on to of Subversion.
  • karim
    karim over 10 years
    What if, say, I have the SVN checked out copy locally. Now I do not have access to the server. Now I want the same thing as above and also create a new branch. Is it possible?
  • smilyface
    smilyface over 2 years
    Hi, the offline website seems to be offline Could you please let us know how it works / how to configure / where to get it (do you have any git public repo?)
  • user384018
    user384018 over 2 years
    I updated the link in my post to the Github project.