2

Is there a simple way to check out every revision in Subversion? Currently, if I wanted to do this, I would have to check out each revision individually.

To answer the inevitable "why do you need this?", I'm going to be working with an offline computer and want to be able to test old code states without connecting to the internet. I may not need to go back all the way, but I'd still like to have all revisions in case I do.

  • 2
    any reason why you can't just make a copy of the repo? – chue x Feb 21 '13 at 01:02
  • It's stored on Google Code. I don't know if I can do that. –  Feb 21 '13 at 01:04
  • well, there is this: http://stackoverflow.com/questions/7317330/svn-backup-from-googlecode I haven't tried the suggestions so I can't make a recommendation. – chue x Feb 21 '13 at 01:12
  • duplicate of [Can you backup/create a dump of a subversion repository without direct access to the server?](https://stackoverflow.com/questions/1984237/can-you-backup-create-a-dump-of-a-subversion-repository-without-direct-access-to) – milahu Dec 02 '21 at 17:38

5 Answers5

7

You can use svnsync to clone the repository locally. svnsync doesn't need any additional level of access than what you already have and you'll end up with a full copy of the repository. Note that if the repository is large this could take some time.

svnsync is documented in the svnbook here: http://svnbook.red-bean.com/en/1.7/svn.ref.svnsync.html

The general process will be.

Create a new repository:

svnadmin create mirror

Initialize the sync (where URL is your Google code repository root):

svnsync initialize file://`pwd`/mirror $URL --source-username user --source-password pass

You can then update the sync to match the current repo with:

svnsync synchronize file://`pwd`/mirror

Note that the file I'm using the pwd command in the URL you can use the full path if you want so you don't necessarily have to stay in the same directory.

You can then relocate your existing working copy to use your local mirror with (where WC is your working copy path and URL is the URL to the Google code repo):

 svn switch --relocate $URL file://`pwd`/mirror $WC

Returning back to the Google Code repository is then as simple as (where URL is the URL to your Google code repo):

svn switch --relocate file://`pwd`/mirror $URL $WC

If you want to continue syncing from the Google code repo I wouldn't commit. However, if you had no intention of updating you could commit and then do a svnadmin dump limited to the versions you changed on your local repo and use svnrdump load to send them to the Google code server.

git-svn is another option. But the above should be able to be done with an existing installation of SVN.

Ben Reser
  • 5,695
  • 1
  • 21
  • 29
  • `svn switch --relocate` deprecated, `svn relocate` must be used today – Lazy Badger Feb 21 '13 at 07:24
  • And - why you suggest svnsync-headache for **offline** user? – Lazy Badger Feb 21 '13 at 07:25
  • @Lazy-Bagder `svn switch --relocate` still works just fine. Unless you want to preface every answer with "If you're using 1.7 do this, if you're using 1.6 do that," then saying `svn switch --relocate` is going to be easiest. Unfortunately, 1.6 is still the version most people have. With respect to svnsync, it's not the only option I even mentioned git-svn. I didn't bother to go into details about it because someone else already had. – Ben Reser Feb 21 '13 at 07:28
  • I realize now that this isn't actually an answer to my question. I don't have svnadmin access, and this creates a copy of the svn archive; I need to have each complete revision in its own directory. –  Feb 23 '13 at 02:19
  • Getting local access to svnadmin is relatively trivial (there are binary distributions of subversion for pretty much any platform here: http://www.wandisco.com/subversion/download). You don't need any special access to the your actual repository with what is mentioned above. Based on your requirement that each rev be in a separate directory I'd suggest that the export method suggested by LazyBadger is the best answer to your question. – Ben Reser Feb 23 '13 at 05:47
  • `svnsync initialize` says `svnsync: E165006: Repository has not been enabled to accept revision propchanges` which is solved [here](https://stackoverflow.com/questions/3061259/how-to-backup-a-remote-svn-repo-while-you-have-not-had-admin-rights) – milahu Dec 02 '21 at 14:16
3

I will strongly recommend you to make use of GIT.

By making use of git-svn, you will be able to clone the svn repository, get every revision and make a corresponding GIT repository.

With the GIT repo containing all version, you can do whatever you want in that offline computer.

Adrian Shum
  • 38,812
  • 10
  • 83
  • 131
  • I agree with this. Plus, once you get back on line, you can push your changes back to the Subversion repository as if you did an Subversion checkout. – David W. Feb 21 '13 at 04:17
  • @LazyBadger This is hardly unrelated to the question. git-svn is a completely valid way of doing what he wants. – Ben Reser Feb 21 '13 at 07:50
  • @LazyBadger I am not a git fan boy ok? the reason for proposing git is because he didn't probably have permission for doing misc svnadmin work (for the project hosted in Google code, and i am not sure if he is the actual developer for the project). Using git, it is easy to get all revision of an URL, as a properly organized git repo, with just privilege to checkout from a SVN repo. I just don't see why it is unrelated to question. – Adrian Shum Feb 21 '13 at 10:01
  • @BenReser - git-svn is bad and ugly way do OP's task. Occam Razor tells it. Why git-svn, not hgsubversion? Why do not use tools of used SCM?! It's pure git-fanboyism - always mention Git, when **it is not needed** – Lazy Badger Feb 21 '13 at 21:42
  • @AdrianShum - you will be not fanboy only **when and if you'll not suggest Git** when it isn't needed. OP must work, and not spend a lot of wasted time on Git learning curve – Lazy Badger Feb 21 '13 at 21:44
  • It is just irrational to judge as the way you used. I suggest git-svn because I actually used it before and it actually works. There are other alternatives too but as long as I haven't tried and I am not sure if it actually works, why should I give that as answer? Moreover, git-svn will serve a great hints imho to OP already. And, simply using git-svn to get the whole history, and only doing checkout in GIT is not anything difficult to learn. Once again, I give this suggestion bcos it works, and it only requires checkout priviledge for SVN, and it works for older version of SVN. Period. – Adrian Shum Feb 22 '13 at 01:06
  • And, SVN was and is still a tools I used daily. So? Being open to other tools doesn't mean being a "fan boy". However what we are pretty sure is someone is actually a git-hater :) At least my answer is more relevant than answer telling OP how to export only a specific revision, or make use of SVN 1.7 feature while Google Code is only providing SVN 1.6 – Adrian Shum Feb 22 '13 at 01:15
  • 1
    svnrdump is **1.7 client-tool**, which work *easy* with **1.6 server**. MYOB! – Lazy Badger Feb 23 '13 at 02:51
  • @LazyBadger I'm assuming the svnrdump comment is directed at me (guessing you replied to the wrong answer). Maybe you're not aware but svnsync is a client-tool as well, you can push or pull, either way works. Under the covers svnrdump does the same thing svnsync does it just serializes the output instead of putting it in a repository. If MYOB means Mind Your Own Business, I don't think that's a particularly constructive comment to sign off with. – Ben Reser Feb 28 '13 at 01:11
  • @BenReser - svnsync is less clent-side. It require (to some degree) knowledge of repository-administration. svnrdump differ from svnsync in some important things: can dump subtree (svnsync - whole repo), does not create link to origin, just dump it once. MYOB was directed to Adrian due to his lame comment with zero-knowledge about topic – Lazy Badger Feb 28 '13 at 02:13
  • I admit I overlooked that svnrdump is a client-tools that works with older version of svn server. However it still doesn't change the fact your MYOB is not constructive. And, if you can assume OP can make use of SVN1.7, why can't I assume OP is possibly feel comfortable to use GIT? I just don't understand why suggesting a feasible solution need to be scolded and labelled as fanboy of something. – Adrian Shum Feb 28 '13 at 03:01
2

Not as nice of a solution as Adrian Shum's, but if you really prefer to stick with SVN, you could also use svnsync. From Stefan's answer on stackoverflow:

First, create a fresh repository on your home machine.

svnadmin create c:\backuprepo

Next, create a file named pre-revprop-change.bat:

echo exit 0 > c:\backuprepo\hooks\pre-revprop-change.bat

then, initialize the sync:

svnsync init file:///c:/backuprepo https://url/of/your/repository

After that, you can simply run

svnsync sync file:///c:/backuprepo

once a day or so, and you'll get only those changes which are not yet in your backup repository. The first time it will take a while, but after you've synchronized your backup repository with the real one, it will only take a few seconds to sync it because only those revisions that are new need to be synched.

Community
  • 1
  • 1
Bradford2000
  • 723
  • 3
  • 14
0

Answer on asked question

You can use svn export 1-st form in oder to export to unversioned tree state of repo in any revision. From svn help export

export [-r REV] URL[@PEGREV] [PATH]
...
Exports a clean directory tree from the repository specified by
URL, at revision REV if it is given, otherwise at HEAD, into
PATH.

You can easy code simplest script, which run across all revisions in repo and perform exports into change changing destination path

Answer on not asked question "How to clone any remote repo"

In Subversion 1.7.* new management-tool was added: svnrdump, which allow perform svnadmin dump|load, but for remote repositories.

In your case you:

  • create local repo in TortoiseSVN
  • load dump of CG-repo (full dump of maybe only trunk part)
  • svnadmin load dump into repo
  • switch your current WC to new repo or checkout from local into new WC (and in any case have full history in traditional way)

Final note about svnrdump

Svnrdump is part of client-side tools in Subversion 1.7.X. Any 1.7 client can freely communicate with 1.6 server without problems

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Ok why would you suggest using svnrdump for cloning a remote repo? When svnsync is far going to be more efficient, since it doesn't have to serialize the data and all it's doing is driving a commit editor off the replay drive. – Ben Reser Feb 21 '13 at 07:31
  • @BenReser - because it's **natural way** for one-time action "have local repo for accessing history offline". "Efficient" has zero-value here – Lazy Badger Feb 21 '13 at 21:31
  • I don't really show how a dump/load cycle is more natural than svnsync from a remote repository to a local repository. It ends up with the exact same result. The only difference is that svnsync should be faster and easier to update the local repository if you get online at some point. – Ben Reser Feb 21 '13 at 23:15
0

The tool rsvndump fulfills exactly this purpose.

  • rsvndump is an older implementation of svnrdump. It provides dump files that you need to feed into svnadmin load in order to do anything with them. Given his comment above that he wants each rev in a separate directory. I don't think this is really what you want. – Ben Reser Feb 23 '13 at 05:48