简体   繁体   English

如何在SVN,Hg或Git中标记一组更改/更改集

[英]How can I mark a group of changes/changesets in SVN, Hg, or Git

I would like to mark an arbitrary group of commits/changesets with a label. 我想用标签标记任意一组提交/变更集。

  • Commit 1 *Mark 1 提交1 *标记1
  • Commit 2 *Mark 2 提交2 *标记2
  • Commit 3 承诺3
  • Commit 4 *Mark 1 提交4 *标记1
  • Commit 5 *Mark 2 承诺5 *标记2

The goal is to easily locate all the changes for a specific mark, and to have that grouping persisted in the VCS directly, as opposed to some outside system like a bug tracking system. 目标是轻松找到特定标记的所有更改,并将该分组直接保存在VCS中,而不是像bug跟踪系统这样的外部系统。

The location and ordering of the marks needs to be arbitrary, and should be able to work with both committed/uncommitted and pushed/unpushed changes. 标记的位置和顺序必须是任意的,并且应该能够使用已提交/未提交和已推送/未按下的更改。

In SVN the best way I know is to just edit the commit notes and add some sort of special text that you can search for eg "**Mark 1". 在SVN中,我知道的最好方法是编辑提交注释并添加一些可以搜索的特殊文本,例如“** Mark 1”。 Or just to make a fake edit and commit it and use its commit note to list all the included revisions. 或者只是进行虚假编辑并提交它并使用其提交注释列出所有包含的修订。

Is there a better solution for SVN? SVN有更好的解决方案吗? Are there equivalent or better solutions for Hg or Git? 对Hg或Git有相同或更好的解决方案吗?

There is no special metadata with Git, beside the commit comment and date, or the tag. 除了提交注释和日期或标记之外,Git没有特殊的元数据。

So you are left with three choices: 所以你有三个选择:

Those two choices won't work well with commits already pushed. 对于已经推送的提交,这两个选择不会很好。

The third choice is associate data to those commits, like a ticket. 第三种选择是关联数据与那些提交,如票证。 See ticgit for example of ticket bug tracking integrated to your git repo. 有关集成到您的git仓库的故障单跟踪示例,请参阅ticgit

In mercurial you'd use a tag: 在mercurial中你会使用一个标签:

hg tag -r REVISIONNUMBER "MARK 1"

In all three systems you mention you're not going to be able to annotate "uncommitted ... changes". 在你提到的所有三个系统中,你都无法注释“未提交的......更改”。

It sounds like if you fully understood the branching options in either git or mercurial you'd probably abandon your notion of "groups of annotations", it's what branches do. 听起来如果你完全理解git或mercurial中的分支选项,你可能会放弃你的“注释组”的概念,这就是分支的作用。

http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/

For SVN you can use "SVN Properties" or the commit log messages. 对于SVN,您可以使用“SVN属性”或提交日志消息。 Check out this answer to a similar problem , and the feature request thread . 查看类似问题的答案 ,以及功能请求主题 If you use revision properties, to find the revisions with a specific value, you need to iterate through all the revisions, which in your case may be an issue regarding performance If you use the commit logs, you can use svn log and parse the output. 如果使用修订属性,要查找具有特定值的修订,则需要遍历所有修订,在您的情况下可能是性能问题如果使用提交日志,则可以使用svn log并解析输出。

Ref: svn book Properties section 参考:svn书籍属性部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM