git-svn 可以正确填充 svn:mergeinfo 属性吗? [英] Can git-svn correctly populate svn:mergeinfo properties?

查看:23
本文介绍了git-svn 可以正确填充 svn:mergeinfo 属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估 git-svn 并试图确定它在特定 svn 存储库中的表现如何.我最关心的是让 git-svn 以在 subversion 存储库中正确设置 svn:mergeinfo 属性的方式执行合并.这可能吗?

这是我目前所做的:

# 检查 SVN 存储库.$ git svn clone svn://server/project1 -T 主干 -b 分支 -t 标签# 确保我们正在处理主干.$ git reset --hard remotes/trunk# 修改工作副本.$ vim 文件.txt# 在本地提交到 git repo.$ git commit -a# 将提交推送回 SVN 服务器.$ git svn dcommit提交到 svn://server/project1/trunk ...M文件.txt承诺 r178M文件.txtr178 = b6e4a3a0c28e7b9aa71d8058d96dcfe7c8a2b349(后备箱)

现在我将如何将该特定提交合并到一个颠覆分支中?同样,在提交更改时 git 正确设置 svn:mergeinfo 属性对我来说非常重要.

解决方案

尽管这是一个老问题,但自从提出这个问题以来,git-svn 的当前状况已经发生了变化.具体来说,在 git 1.7.5 中,当 dcommitting 回到 svn 时,对设置 svn:mergeinfo 的支持有限.

git svn dcommit 现在接受 -mergeinfo= 标志.引用 1.7.5+ 手册页:

<块引用>

-mergeinfo=

<块引用>

在 dcommit 期间添加给定的合并信息(例如 --mergeinfo="/branches/foo:1-10").所有 svn 服务器版本都可以存储此信息(作为属性),从 1.5 版开始的 svn 客户端可以使用它.git svn 目前没有使用,也不会自动设置.

虽然使用它时应该非常小心.即使手册页说添加",它的真正含义是替换".也就是说,svn:mergeinfo 属性是根据传递的内容设置的,它不会将指定的修订添加到已经存在的 svn:mergeinfo.从我的错误中吸取教训......

看来他们仍在进一步改进这一点.从 git-svn 1.7.7 起,以下文字是添加到 git-svn 手册页:

<块引用><块引用>

配置键:svn.pushmergeinfo

此选项将导致 git-svn 尝试在可能的情况下自动填充 SVN 存储库中的 svn:mergeinfo 属性.目前,这只能在提交非快进合并时完成,其中除第一个之外的所有父级都已被推送到 SVN.

I am evaluating git-svn and trying to determine how well it will play with a particular svn repository. I am mostly concerned with getting git-svn to perform merges in such a way that the svn:mergeinfo property is correctly set in the subversion repo. Is this possible?

Here is what I have done so far:

# Checkout the SVN repo.
$ git svn clone svn://server/project1 -T trunk -b branches -t tags

# Make sure we are working on trunk.
$ git reset --hard remotes/trunk

# Modify the working copy.
$ vim file.txt

# Commit locally to the git repo.
$ git commit -a

# Push the commits back to the SVN server.
$ git svn dcommit
Committing to svn://server/project1/trunk ...
    M   file.txt
Committed r178
    M   file.txt
r178 = b6e4a3a0c28e7b9aa71d8058d96dcfe7c8a2b349 (trunk)

Now how would I go about merging that particular commit into one of the subversion branches? Again, it is very important to me that git properly set the svn:mergeinfo property when committing the change.

解决方案

Even though this is an old question, the current state of affairs with git-svn has changed since it was asked. Specifically, in git 1.7.5, there is some limited support for setting the svn:mergeinfo when dcommitting back to svn.

git svn dcommit now accepts the -mergeinfo=<mergeinfo> flag. To quote from the 1.7.5+ man page:

-mergeinfo=<mergeinfo>

Add the given merge information during the dcommit (e.g. --mergeinfo="/branches/foo:1-10"). All svn server versions can store this information (as a property), and svn clients starting from version 1.5 can make use of it. git svn currently does not use it and does not set it automatically.

One should be very careful when using this though. Even though the man page says "add" what it really means is "replace". That is, the svn:mergeinfo attribute is set based on what is passed, it does not add the specified revisions to the already existing svn:mergeinfo. Learn from my mistake…

Edit:

It appears that they are still working on improving this even further. As of git-svn 1.7.7, the following text was added to the git-svn man page:

config key: svn.pushmergeinfo

This option will cause git-svn to attempt to automatically populate the svn:mergeinfo property in the SVN repository when possible. Currently, this can only be done when dcommitting non-fast-forward merges where all parents but the first have already been pushed into SVN.

这篇关于git-svn 可以正确填充 svn:mergeinfo 属性吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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