Git SVN 和外部

发布于 2024-10-03 21:30:34 字数 824 浏览 5 评论 0原文

我想开始将 git-svn 用于使用中央 SVN 存储库的项目。问题是我们使用的是 Windows,而 SVN 项目使用外部组件以便能够在两个不同的项目中重用某些代码。在 Unix 系统中,我们会使用软链接,但由于我们被 Windows 困住,我们决定使用外部链接作为 Windows XP 限制的解决方法。如果您对此有更好的解决方案,我们将非常高兴听到! svn 结构如下:

branch
tag
trunk
 -web
  --views
     ---External to commonFiles
-admin
  --views
    ---External to commonFiles
-commonFiles

我是否可以使用 git-svn,如果可以,我该怎么做?

编辑 我长期以来一直在寻找好的解决方案,但在写完这篇文章后,我开始思考这实际上与 svn:externals 有多大关系。如果我使用 git svn 我会得到这个

branch
tag
trunk
 -web
  --views
     ---commonFiles (empty folder since externals didn't work)
-admin
  --views
    ---commonFiles (empty folder since externals didn't work)
-commonFiles

由于我在 git 中有 commonFiles 文件夹,我可以使用与 git 中的 svn 相同的技术吗?要将空的 commonFiles 文件夹链接到使用 git 维护的 commonFiles 吗?

I want to start use git-svn for a projects which uses a central SVN repository. The problem is that we are using windows and that the SVN project uses externals in order to be able to reuse some code in two different projects. In a Unix system we would have used soft links but since we are stuck with windows we decided to go with externals as a workaround for the limitations in windows xp. If you have a better solution for this a would be more than happy to hear that! The svn structure is as follows:

branch
tag
trunk
 -web
  --views
     ---External to commonFiles
-admin
  --views
    ---External to commonFiles
-commonFiles

Is it possible for me to be able to use git-svn and if so how can I do it?

Edit
I have been searching for good solution for a long time now but after writing this post I started to think how much this actually has to do with svn:externals. If I use git svn I will get this

branch
tag
trunk
 -web
  --views
     ---commonFiles (empty folder since externals didn't work)
-admin
  --views
    ---commonFiles (empty folder since externals didn't work)
-commonFiles

Since I have the commonFiles folder in git, can I use the same technique as in svn in git? To link the empty commonFiles folders to the commonFiles that are maintained with git?

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

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

发布评论

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

评论(4

冷情 2024-10-10 21:30:34

是的,您应该能够通过 git 子模块获得 git 等效项。 .git 文件夹和 .gitmodules 文件将存在于与 web 和 admin 签出的同一级别中。 .git 文件夹将存在于外部文件夹中。您可能希望忽略 git 中的 .svn 文件夹,反之亦然。

希望这有帮助!

Yes, you should be able to have a git equivelant via git submodule. A .git folder and a .gitmodules file would exist in at the same level as web and admin checks out to. A .git folder would exist in the External folder. You would want to ignore .svn folders in git and vice versa for svn.

Hope this helps!

绝對不後悔。 2024-10-10 21:30:34

您可以尝试使用分离工作树与多个存储库,然后使用mr 工具。为了促进多个存储库的工作。

You can try having detached worktrees with multiple repos and then use the mr tool. To facilitate the work with multiple repos.

茶花眉 2024-10-10 21:30:34

正如未知表明的那样,交叉点是一个不错的选择。

当您查看源代码树时,它将如下所示:

branch
tag
trunk
 -web
  --views
-admin
  --views
-commonFiles

外部已被省略。
获取外部列表,您可以在现有存储库上使用以下命令:

svn propget svn:externals -R

对于相对外部(以 .. )这很简单。您可以使用 mklink 创建连接。在此示例中,运行以下命令:

mklink /J trunk\web\views\commonFiles trunk\commonFiles
mklink /J trunk\admin\views\commonFiles trunk\commonFiles

您可以将这些命令添加到 git-hook 以确保它们是在签出时创建的。

As unkownt suggests junctions is a good option.

When you check out the source tree will look like this:

branch
tag
trunk
 -web
  --views
-admin
  --views
-commonFiles

The externals have been omitted.
To get the list of externals you can use the following command on an existing repository:

svn propget svn:externals -R

For relative externals (those starting with ..) this is simple. You can use mklink to create a junction. In this example run the following commands:

mklink /J trunk\web\views\commonFiles trunk\commonFiles
mklink /J trunk\admin\views\commonFiles trunk\commonFiles

You could add these commands to a git-hook to ensure that they are create on check out.

我现在想出了一个对我来说非常有效的解决方案!我发现可以在 Windows XP 中使用称为连接的东西。连接点与安装类似,不同之处在于,如果删除一个文件夹,其他文件夹也会被删除。因此,我最终要做的是在 commonFiles 文件夹之间创建连接,并将忽略添加到视图中的文件夹中。

branch
tag
trunk
 -web
  --views
     ---commonFiles (junction to *, ignored in git)
-admin
  --views
    ---commonFiles (junction to *, ignored in git)
-commonFiles (*, controlled by git)

I have now come up with a solution which a works great for me! I found out that it is possible to use something called junctions in windows xp. Junctions are something similar to mount with the difference that if you remove a folder the other folder also will get removed. So what I ended up doing is to to create junctions between my commonFiles folders and add ignores to the folders withing the views.

branch
tag
trunk
 -web
  --views
     ---commonFiles (junction to *, ignored in git)
-admin
  --views
    ---commonFiles (junction to *, ignored in git)
-commonFiles (*, controlled by git)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文