git& svn外部 - 最终的解决方案呢? [英] git & svn externals - a final solution yet?

查看:261
本文介绍了git& svn外部 - 最终的解决方案呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我目前用于我的svn项目的工作流程(我从不使用svn分支,有些项目也由其他人积极开展工作):

    在服务器上
  • ,执行可能需要几个小时的inital git svn fetch 。另外创建一个'build'分支。
  • 在开发机器上克隆现在很快: git clone srv://project.git,git checkout build 然后是 git update-refs ...,git svn fetch 以恢复到svn存储库的链接
  • 工作,提交,工作提交,...

  • 检查是否理智, git push build 到服务器并触发构建在Hudson中为该分支

  • 存储工作,以便我可以在另一台机器上工作,并在满足时推送构建分支

  • ,联接提交在合乎逻辑的步骤中(例如每个bug一个),提交svn并重置所有内容,如 git checkout master,git merge build,git svn dcommit,git push,git checkout build,git rebase master,git push build



输入svn externals。我尝试了每个脚本这里已经但他们都失败了。我的外部设置是这样的:

  / path / to / xx 
/ path / to / y / zy / z
/path/to/a/b.file a / b.file

和这些脚本就像在文件系统的根目录下创建 / path / to / x 一样,而 git svn fetch / path / to / x 。单个文件似乎也会导致更多问题。 (subquestion 1:什么是svn:externals格式,这些脚本是为那么写的?)

似乎并没有很难修改其中一个脚本来处理我的情况并正确地复制目录结构后,但我留下了一个主要问题:如果我更改x和y / z目录中的文件,我没有看到一种方法将它加入到单个svn提交,这是我开始使用git的原因之一。



因此,问题是否有一种方法可以复制上述工作流程,仅使用部分的某个svn仓库,以这种方式,我可以在根目录下执行svn dcommit?我更喜欢现成的解决方案,可以在Linux和Windows上运行。



编辑我通过其中一个脚本我发现并复制了svn externals的目录结构。输出:

  git svn clone -r HEAD srv:// svn / repo / path / to / projects.sln 
在xxx / projects.sln / .git /
中初始化的空Git存储库无效的文件系统路径语法:'/ svn / repo /!svn / vcc / default'上的REPORT请求失败:
无法从yyy / git / libexec / git-core / git-svn第5114行

subquestion 2:是不是可以通过git svn获取单个文件?

解决方案

不幸的是,svn的外部相当灵活。我已经运行了许多脚本,将它们视为< path> < url>,但< url> <路径>也是允许的。所以我认为一些脚本在这方面只是被打破了。



回答你的第二个问题:不。 'git svn fetch'需要在Subversion的repo子树上运行,但它需要像分支一样处理。唯一映射到这个范例中的是一个目录(例如,trunk /)。 FWIW,Bazaar和Mercurial也在这里受苦。在一天结束时,Subversion只是一个版本化的文件系统,而Git有一个分支的第一类概念。这是不合适的阻碍之一。 : - (

this is the workflow I currently use for my svn projects (I never use svn branches, and some projects are actively worked on by other people as well):

  • on the server, do the inital git svn fetch which might take hours. Also create a 'build' branch.
  • on a development machine cloning is now fast: git clone srv://project.git, git checkout build followed by git update-refs ..., git svn fetch to restore the link to the svn repository
  • work, commit, work commit, ...
  • to check if things are sane, git push build to the server and trigger a build in Hudson for that branch
  • to store work so that I can work on it from another machine, also push build branch
  • when satisfied, join commits together in logical steps (eg one for each bug), commit to svn and reset everything like git checkout master, git merge build, git svn dcommit, git push, git checkout build, git rebase master, git push build

Enter svn externals. I tried every script here already but all of them fail. My externals are setup like this:

/path/to/x x
/path/to/y/z y/z
/path/to/a/b.file a/b.file

and the scripts do things like trying to create /path/to/x in the root of the filesystem and git svn fetch /path/to/x. Also the single files seem to cause more problems. (subquestion 1: what is the svn:externals format these scripts were written for then?)

It doesn't seem to hard modifying one of the scripts to handle my situation and replicate the directory structure I'm after correctly, but then I'm left with a major problem: if I change a file in both x and y/z directories, I don't see a way to join this into a single svn commit and that is one of the reasons I started using git in the first place.

Hence the question: is there a way I can replicate the above workflow, using only parts of a certain svn repository, in such a way that I can do svn dcommit in the root? I'd prefer a ready-to-use solution that works both on linux and windows.

edit I quickly hacked through one of the scripts I found and made it replicating the directory structure of the svn externals. I cannot clone single files though, here's output:

git svn clone -r HEAD srv://svn/repo/path/to/projects.sln
Initialized empty Git repository in xxx/projects.sln/.git/
Invalid filesystem path syntax: REPORT request failed on '/svn/repo/!svn/vcc/default':
  Cannot replace a directory from within at yyy/git/libexec/git-core/git-svn line 5114

subquestion 2: is it not possible fetching a single file through git svn?

解决方案

Unfortunately, svn's externals are quite flexible. I've run across a number of scripts that treat them as <path> <url>, but <url> <path> is also allowed. So I think some of the scripts are just broken in that regard.

To answer your second subquestion: no. 'git svn fetch' needs to operate on a subtree of Subversion's repo, but it needs to be something it can treat like a branch. The only thing map well into that paradigm is a directory (trunk/, for example). FWIW, Bazaar and Mercurial suffer here too. At the end of the day, Subversion is just a versioned file system, whereas Git has a first class concept of a branch. This is one of those mismatches getting in the way. :-(

这篇关于git&amp; svn外部 - 最终的解决方案呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆