如何在subgit repo中找到SVN修订版本? [英] How to find SVN revision in subgit repo?
问题描述
我使用Subgit访问Subversion回购。它工作的很好,但有时候,特别是与使用普通Subversion客户端访问repo的用户进行交流时,我真的很想找到特定changeset对应的SVN修订版。
我可以使用 git
在我的本地回购库中的某个地方找到SVN修订版本号吗?
是的,你可以轻松地做到这一点。您应该修改克隆的Git存储库中的 .git / config
文件以添加
[remoteorigin]
...
fetch = + refs / svn / map:refs / notes / commitits
$ b $ p 选项,然后运行 git fetch
,如在<建议的客户端Git配置>部分中所述<一个href =http://www.subgit.com/remote-book.html =noreferrer> SubGit book 。之后,克隆库中的 git log
命令将显示修订号。
如果您想在服务器端(如果你没有在你的项目中使用Git笔记作其他用途),你可以在服务器机器上运行
$ git update-ref refs / notes / commitits refs / svn / map
一次性Git注释创建或您可以在该存储库中运行
$ cd refs
$ mkdir笔记
$ echo refs:refs / svn / map>注释/提交
使refs / notes / commitits跟随由SubGit更新的refs / svn / map并存储最新的修订版本SHA-1映射。之后,服务器上的 git log
也会显示修订号。
如果要将修订版转换为SHA- 1脚本中的哈希(在以上述任何方式设置Git笔记之后),您可以使用此命令
$ git log - -format =%H%N - all
结合行解析功能。例如。如果你不太关心转角情况(例如名称r $ REV branch的分支名称),通过修订版REV获取SHA-1和更改分支名称,您可以运行
$ git log --format =%H%N--all | grepr $ REV
同样,您可以在这里grep SHA-1或分支名称。
I'm using Subgit to access a Subversion repo. It works great, but at times, especially when communicating with users who access the repo using an ordinary Subversion client, I'd really like to find to which SVN revision a particular changeset corresponds.
Can I, using git
find the SVN revision number somewhere in my local repo?
Yes, you can do that easily. You should just modify your .git/config
file in the cloned Git repository to add
[remote "origin"]
...
fetch = +refs/svn/map:refs/notes/commits
option and then run git fetch
, as it is described in "Recommended client-side Git configuration" section of SubGit book. After that git log
command on the cloned repository will display revision numbers.
If you want to do that on the server side (and if you don't use Git notes for other purposes in your project), you can run on the server machine
$ git update-ref refs/notes/commits refs/svn/map
for one-time Git notes creation or you can run in that repository
$ cd refs
$ mkdir notes
$ echo "refs: refs/svn/map" > notes/commits
to make refs/notes/commits follow refs/svn/map that is updated by SubGit and stores the latest revision <-> SHA-1 mapping. After that git log
on the server will also display revision numbers.
If you want to convert revisions to SHA-1 hashes in scripts (after setting up Git notes in any way mentioned above), you can use this command
$ git log --format="%H %N" --all
in combination with line-parsing functions. E.g. if you don't care much about corner cases (e.g. branch name of name "r$REV branch"), to get SHA-1 and changed branch(es) name by revision REV you can run
$ git log --format="%H %N" --all | grep "r$REV "
Similarly you can grep SHA-1 or branch names here.
这篇关于如何在subgit repo中找到SVN修订版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!