SVN:一个工作副本,两个存储库?
我想知道如何为我的一个工作副本设置两个存储库。 我的服务器中需要一个存储库,以便我可以在两台电脑之间签入/签出; 我的本地电脑中需要另一个存储库,以便我可以快速看到 diff 的结果(我的 svn 服务器位于缓慢的共享主机上)
我该怎么做?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
查看存储库复制。
您可以设置一个 cron 作业来定期从一个存储库同步到另一个存储库。 但您必须确保提交仅发生在两者之一。
如果两个存储库都发生提交,则可能是分布式版本控制系统,例如 git、Bazaar 或 Mercurial< /a> 你更感兴趣吗? 例如,Git 甚至允许您直接从 Subversion 存储库中提取数据或推送到 Subversion 存储库。
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.
Subversion 不使用网络访问来执行其 diff 操作。 这是 Subversion 相对于 CVS 的巨大优势之一。 所以我不确定您为什么会遇到这个特定问题。
另一种方法是在本地 PC 上使用 Git,特别是
git-svn
。 您可以在本地计算机上获得整个存储库历史记录的完整副本,并能够在本地比较和查看历史记录(以及 Git 为您提供的许多其他功能)。 现在,只要有可能,我都会使用 git-svn 来访问 Subversion 存储库。Subversion doesn't use network access for its diff operation. This is one of the great benefits of Subversion over CVS. So I'm not sure why you would be encountering that specific problem.
An alternative is to use Git and specifically
git-svn
on your local PC. You get a full copy of the entire repository history on your local machine, with the ability to diff and view history locally (along with the many other features Git gives you). Whenever possible, I now usegit-svn
to access Subversion repositories.如果您不必使用 SVN,那么您可能最好使用分布式版本控制系统,例如 Mercurial 或 Git。 每台 PC 都有自己的存储库副本,并且可以直接在 PC 之间或通过中央服务器上的另一个副本同步更改。 由于每台 PC 都在本地存储了完整的存储库,因此您无需访问网络即可执行 diff 或任何其他操作。
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.
如果您的本地机器是 Linux,您可以创建一个 crontab 条目来每 X 分钟更新一次 svn,以使其与后台的服务器保持同步。 从那里您将在本地 svn 服务器上获得最新的副本以进行比较。
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.
您可以尝试使用 svk 作为本地客户端而不是 svn。 svk 是一个使用 svn 存储库的伪分布式版本控制系统。
您可以使用 svk 来设置存储库的镜像,对其进行同步,然后您可以根据自己的喜好进行差异化,可以根据需要进行多次修订,而且都是本地的。
您还可以创建镜像存储库的一个分支并将其用作签出,那么您的提交也是仅限本地的操作,当您准备好一批提交时,您将它们推送到远程 svn 存储库(并拉取)其他用户又改回来了,类似于 svn update 命令)。
两个警告:
除此之外,我第二次使用 bazaar、mercurial 或 git,正如其他人建议的那样。 Bazaar 可能是最容易使用的,并且有一个 TortoiseBzr GUI,我的一位同事说它非常可靠。
Git 是最难使用的。 它就像瑞士军刀,宽度几乎大于长度,里面装满了所有的小玩意和玩意儿,挂在上面,弹簧太紧,以至于你偶尔会在试图撬开刀片时割破手指出去。
You could try using svk as your local client instead of svn. Svk is a pseudo-distributed version control system using svn repositories.
You would use svk to set up a mirror of the repository, synchronise it, and you can diff to your heart's content, as many revisions back as you like and it is all local.
You could also make a branch of the mirrored repository and use that as your checkout, then your commits are also a local-only operation, and when you're ready with a batch of commits you push them to the remote svn repository (and pull other user's changed back, similar to an svn update command).
Two caveats:
Other than that, I second using bazaar, mercurial or git as others have suggested. Bazaar is probably the easiest to use, and has a TortoiseBzr GUI which a collegue of mine says is pretty solid.
Git is the hardest to use. It is like the swiss-army knife that is almost wider than it is long, with all the little gadgets and do-dads in it and hanging off it, with the springs so tight that you occasionally slice a finger open trying to prise a blade out.
SVN 本质上并不适合此类用例。 您必须在这里或那里进行一些调整(例如编写 cron)。 如果您想要开箱即用的东西来适应此类用例,请尝试 GIT。
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.
我不相信标准存储库复制会给您带来您想要的东西。 通过这种设置,一个代理始终是只读的,我认为您的情况并非如此。
您必须在签入之前执行 svn switch --relocate 来切换您正在查看的存储库。 有点容易出错。
您所追求的是通过代理写入。
如果您在本地计算机上使用 apache 和 mod_svn_dav 进行设置,您将拥有一个本地存储库,它接收所有更新,并且您可以轻松地进行比较和签出,但所有写入都会返回到其他人的实际存储库正在使用并从中获取更新。
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.
svn diff 的结果并不取决于服务器的连接速度; 这是完全本地化的操作。
The result of svn diff doesn't depend on the speed of your connection to the server; it's a fully local operation.