views:

82

answers:

3

I would like to mark an arbitrary group of commits/changesets with a label.

  • Commit 1 *Mark 1
  • Commit 2 *Mark 2
  • Commit 3
  • Commit 4 *Mark 1
  • Commit 5 *Mark 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.

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 e.g. "**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? Are there equivalent or better solutions for Hg or Git?

+1  A: 

For SVN you can use "SVN Properties" or the commit log messages. 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.

Ref: svn book Properties section

Ramiro Gonzalez Maciel
+2  A: 

There is no special metadata with Git, beside the commit comment and date, or the tag.

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.

VonC
ticgit looks interesting, thanks. I like the idea of using a branch to store pseudo-changes with references to changesets.
sylvanaar
+2  A: 

In mercurial you'd use a tag:

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.

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

Ry4an
+1 for pulling out the "groups of annotations" thinking from the post.
msw
Your response comes across as condescending, but I'm assuming that it isn't. Uncommitted changes means being able to add new changes to an existing group that has already been marked. Branches are an inappropriate solution for what I am asking, and afaik mercurial or any tags do not meet the goals of the question unless you change the question (which you did).
sylvanaar
I assure you condescending wasn't the goal, but "uncommitted" has a very specific meaning in version control land, and it's still not clear to me what you mean by it. To suggest I changed your question is ridiculous; I merely added a space character before each of your bullet lists items so it would be, you know, a bullet list.
Ry4an
I didn't mean change my question literally - i meant figuratively - probably in context with the first comment to your answer. Anyhow, thanks for taking the time to answer the question. Your help is appreciated.
sylvanaar