SVN: one working copy, two repositories?

2019-01-22 13:12发布

I'd like to know how can I set two repositories for my one working copy. I need one repository in my server, so that I can check in/out between two pcs; I need another repository in my local pc, so that I can see the result of diff quickly (my svn server is on a slow shared host)

How can I do that?

8条回答
forever°为你锁心
2楼-- · 2019-01-22 13:38

If your local box is linux, you could create a crontab entry to svn update every X minutes to keep it synced with the server in the background. From there you would have the most recent copy on your local svn server to diff from.

查看更多
Juvenile、少年°
3楼-- · 2019-01-22 13:42

Have a look at repository replication.

You can set up a cron job to periodically synch from one repository to the other. But you have to make sure that commits only happen to one of the two.

If commits will happen to both repositories, maybe a distributed versioning system such as git, Bazaar or Mercurial is more up your alley? Git, for one, even lets you pull from and push to a Subversion repository directly.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-01-22 13:51

I'm not convinced that standard repository replication will give you what you want. With that setup, one proxy is always read-only, and I don't think in your situation that's the case.

You would have to do the svn switch --relocate thing to switch which repository you're looking at just before checkin. Somewhat error prone.

What you're after is a write through proxy.

If you set this up using apache and mod_svn_dav on your local machine, you'll have a local repository which receives all updates and that you can diff against and checkout against easily, but for which all writes go back to the actual repository that everyone else is using and getting updates from.

查看更多
我命由我不由天
5楼-- · 2019-01-22 13:53

The result of svn diff doesn't depend on the speed of your connection to the server; it's a fully local operation.

查看更多
仙女界的扛把子
6楼-- · 2019-01-22 13:54

If you don't have to use SVN, you may be better to use a distributed version control system, such as Mercurial or Git. Each PC will have its own copy of the repository, and changes can be synchronized either directly between PCs or via another copy on a central server. Since each PC has the full repository stored locally you can do diff or any other operation without network access.

查看更多
做个烂人
7楼-- · 2019-01-22 13:54

SVN is not inherently suited for such use cases. You'll have to tweak with things here and there (like writing crons). If you want something which works out of the box to suit such use cases, try GIT.

查看更多
登录 后发表回答