如何将项目 fork 到本地 SVN 存储库?

发布于 2024-10-19 11:00:12 字数 275 浏览 8 评论 0原文

  • 我想要在本地 SVN 存储库中拥有一个开源项目的副本。
  • 我想将更改提交到我的存储库,但不提交到开源项目的中央存储库。
  • 我想查看来自开源项目存储库的更新并查看它们。
  • 如果我喜欢这些更改,我想将它们放入我的本地存储库。

  • 我可以通过哪些方式来满足这些要求?

  • 哪种方式最好,为什么?

通过这些方式,开源项目的 SVN 历史记录可以在我的存储库中保留吗?

提前致谢。

  • I want to have a copy of an open source project in a local SVN repository.
  • I want to commit changes to my repository, but not to the central repository of the open source project.
  • I want to see the updates coming from the open source projects repository and review them.
  • If I like those changes I want to put them into my local repository.

  • Which ways can I go, to satisfy these requirements?

  • Which way is the best and why?

Will the SVN history of the open source project stay availible inside my repository whith those ways?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

近箐 2024-10-26 11:00:12

由于 gbjbaanb 建议,您必须使用 Vendor Branches 并保持纯粹的 Subversion

您可以(必须)在书中描述的工作流程中添加一个小细节:

  • 如果是上游项目也由 Subversion 处理
  • 如果您可以从您自己的服务器位置访问项目的存储库,

您可以将上游存储库(/trunk ???)的一部分链接到存储库的供应商分支(使用 svn:externals)。这样你就可以

  • 监控上游活动(svn upsvn log
  • 在自己的服务器上拥有独立于上游主线
  • 使用通常的合并将上游更改集成到你的代码中

As it was suggested by gbjbaanb, you have to use Vendor Branches and stay it pure Subversion

You can (have to) add to described in book workflow one small detail:

  • If upstream project also handled by Subversion
  • If you can reach project's repository from location of your own server

you can link part of upstream repo (/trunk ???) into vendor's branch of your repo (using svn:externals). This way you can

  • Monitor upstream activity (svn up, svn log)
  • Have own independent from upstream mainline on own server
  • Integrate upstream changes into your code, using usual merge
_蜘蛛 2024-10-26 11:00:12

查看此 StackOverflow 主题并回答:管理私有的正确工作流程Subversion fork。 我有一个与你非常相似的问题,我将继续使用 git-svn [在接受的答案中提到的桥梁]。另请参阅 Git 和其他系统 - Git 和 Subversion

主要方法优点:这样您就可以始终使用 SVN 作为“后端”、最终存储库。

我希望这有帮助。爱与和平,

Have a look at this StackOverflow Topic and answer: Correct workflow for managing a private Subversion fork. I have a very similar problem to yours and I am going to proceed using the git-svn [bridge aluded to in the accepted answer]. See also Git and Other Systems - Git and Subversion

Main Approach Advantage: This way you can always use SVN as the "back end", final repository.

I hope this helps. Love and peace,

半步萧音过轻尘 2024-10-26 11:00:12

我不认为只有通过 SVN 才能实现这一点。您想要的是某种分散的版本控制系统,例如 Git 或 Mercurial。

我不知道您是否已经与其中之一合作过,但是您可以通过两者来实现您想要的目标。

以下是我的想法的一些步骤(从 Mercurial 的角度来看,但这与 Git 完全相同):

  1. 初始化一个 Mercurial 存储库(在空目录中的 hg init
  2. 签出 svn 存储库
  3. 添加所有文件到 Mercurial 存储库 (hg addremove)
  4. 将更改提交到 Mercurial 存储库 (hg commit -m "initial commit")
  5. 将 Mercurial 存储库克隆到其他位置 (hg clone /path/to/myrepo . 在一个空目录中)

您现在可以在这个 Mercurial 克隆中工作并在其中提交。然而,永远不要将更改推送到原始的 Mercurial 存储库中,这一点非常重要。

要更新 SVN 存储库,请按照以下步骤操作:

  1. 在 SVN checkout 中: svn update
  2. 仍然在 SVN checkount hg addremove; hg commit -m "svn update"
  3. 在工作目录(mercurial clone)中: hg pull;汞合并; hg commit -m "merging svn update"

为此,工作目录必须是干净的,即所有更改都必须已提交。

基本上,我们正在做的就是使用 Mercurial 作为 SVN 存储库的某种代理。您可以提交到本地 Mercurial 克隆,而无需修改原始源,并且仍然从 SVN 进行更新,然后将这些更改合并到本地 Mercurial 克隆中。

我不完全知道如何使用 Git 重现这些步骤,但我知道这也是可能的。如果您了解其中之一,您甚至可以使用任何其他 dvc。

我完全同意这个解决方案有点复杂,但我从未找到更简单的方法来实现这一点。我以 CVS 存储库为源,这样工作了 9 个月,从未遇到过问题。

但是,如果您从未听说过 dvcs、git 或 Mercurial,我强烈建议您阅读一些文档,因为这些步骤非常复杂,而且很快就会出错。

希望这有帮助。

编辑:

您还可以使用 SVN 外部,但是< strong>您将无法查看和选择要导入到存储库中的修改。

您必须使用 : 在目录上设置 svn:externals 属性,

svn propedit externals adirectory

这将打开一个编辑器,让您编辑 adirectory 目录的外部内容。在这里,您为要在此目录中签出的每个外部存储库添加一行,如下所示(对于每一行):

path/where/tocheckout    http://svn.example.com/repos/project

下次进行更新时,将在给定目录中签出 svn 存储库,并包含完整的历史记录。

(自从我使用 svn:externals 以来已经很长时间了,也许有些解释是错误的,但这可能足以了解全局)

I don't think there is a way of achieving that only with SVN. What you want is some sort of decentralized version control system, like Git or Mercurial.

I don't know if you've already work with one of them, but you can achieve what you want with both.

Here's some step to my idea (from a Mercurial point of view, but this will be quite identical with Git) :

  1. Init a mercurial repository (hg init in an empty directory)
  2. Checkout the svn repository
  3. Add all the files to the mercurial repository (hg addremove)
  4. Commit the changes to the mercurial repository (hg commit -m "initial commit")
  5. Clone the mercurial repository somewhere else (hg clone /path/to/myrepo . in an empty directory)

You can now work in this mercurial clone and commit in it. However it's really important to never push the changes in the original mercurial repository.

For updating the SVN repository, follow these steps :

  1. In the SVN checkout : svn update
  2. Still in the SVN checkount hg addremove; hg commit -m "svn update"
  3. In the workind directory (mercurial clone) : hg pull; hg merge; hg commit -m "merging svn update"

For this to work, the working directory must be clean, ie all the changes must have been committed.

Basically, what we're a doing is using Mercurial as some sort of proxy to the SVN repository. You can commit to the local Mercurial clone without ever modifying the original source and still update from SVN and then merge theses changes in the local Mercurial clone.

I don't exactly know how to reproduce theses steps with Git, but I know it's also possible. You can even any other dvcs if you know one of them.

I totally agree that this solution is a bit complicated, but I never found an easier way to achieve this. I worked like this for 9 month with a CVS repository as a source and never had a problem.

However, if you've never heard of dvcs, git or mercurial, I strongly advised that you read some documentation, because theses steps are pretty complicated and things can go wrong pretty fast.

Hope this help.

EDIT:

You can also use SVN externals, but you won't be able to review and choose the modifications you want to import in your repository.

You will have to set a svn:externals property on a directory with :

svn propedit externals adirectory

Which will open an editor to let you edit the externals for the adirectory directory. Here you add a line for each external repository you wand to checkout in this directory like this (for each line) :

path/where/tocheckout    http://svn.example.com/repos/project

The next time you'll do an update, the svn repository will be checkouted in the given directory, with the full history.

(it's a long time since I used svn:externals, maybe some of the explanation is wrong, but it'll probably enough to get the big picture)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文