How to set Subversion properties with git-svn

匿名 (未验证) 提交于 2019-12-03 02:47:02

问题:

Is there a way to set subversion properties on a git repository that was created by git-svn?

In my case, I want to edit the version of svn:external, svn:ignore and svn:executable.

However, the only way to do so seems to involve a check-out with the subversion client. Is there a way to edit svn properties without having to check out the repository twice (one time for git and one time with svn for the properties)?

回答1:

git-svn does not support Subversion properties. When I run into this problem, I usually end up having two checkouts.

This is mentioned in the git-svn documentation under BUGS:

We ignore all SVN properties except svn:executable. Any unhandled properties are logged to $GIT_DIR/svn/<refname>/unhandled.log



回答2:

Note: git 2.3.0 (February 2015) supports proset with git svn.
See commit 83c9433 by Alfred Perlstein (splbio):

git-svn: support for git-svn propset

This change allows git-svn to support setting subversion properties.

It is useful for manually setting properties when committing to a subversion repo that requires properties to be set without requiring moving your changeset to separate subversion checkout in order to set props.

There is a nit to point out: the code does not support adding props unless there are also content changes to the files as well.
This is demonstrated in the testcase.

So, as seen in t/t9148-git-svn-propset.sh, this now works:

git svn propset "$1" "$2" "$file"  # like git svn propset "svn:keywords" "FreeBSD=%H" "foo"


回答3:

Started working on a patch to support git svn propset here: git svn propset support



回答4:

It's possible, just clone your SVN repository with SmartGit. It translates svn:executable, svn:externals and svn:ignore to executable, .gitsvnextmodules and .gitignore. So you can modify them and push back that will result in corresponding properties modification.

If you have an access to your SVN server you may install SubGit into it. It translates svn:executable and svn:ignore on the server side providing a Git interface to your SVN repository.



回答5:

You can also used svnmucc, in case you don't want to have a whole svn checkout just to set props (my remote repo is really big).

Here's my command for adding a line to svn:ignore, replace URL, DIR, and VALUE.

svnmucc -U URL propset svn:ignore "`git svn propget svn:ignore DIR; echo VALUE`" DIR


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!