git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Tracking changes in git with a change number....
@ 2011-07-11 17:29 Rice, James M CIV NSWCDD, K73
  2011-07-12  5:37 ` Damien Wyart
  2011-07-12  5:50 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: Rice, James M CIV NSWCDD, K73 @ 2011-07-11 17:29 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

We are getting ready to switch over to git as our CM tool, but have an issue.

In our organization we track changes via a Change Request (CR) number.  We may end up with multiple commits, by one or more users under a single CR number.  When we deliver our CM folks want to be able to see all the files that have changed for a particular CR number.  Is there an elegant way to do this in git? 

Restating the problem.  I wish for our developers to be able to reference multiple commits with one number, and then find those commits via that number.  And I don't mind scripting to accomplish this.  I know, that CR # can be put in the commit message, then I can grep and parse the log, that is the hard way.

It would seem that this would be a relatively common problem.  Any help would be greatly appreciated!

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tracking changes in git with a change number....
  2011-07-11 17:29 Tracking changes in git with a change number Rice, James M CIV NSWCDD, K73
@ 2011-07-12  5:37 ` Damien Wyart
  2011-07-12  5:50 ` Jeff King
  1 sibling, 0 replies; 5+ messages in thread
From: Damien Wyart @ 2011-07-12  5:37 UTC (permalink / raw)
  To: Rice, James M CIV NSWCDD, K73; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

Hi,

* Rice, James M CIV NSWCDD, K73 <james.rice2@navy.mil> [2011-07-11 13:29]:
> In our organization we track changes via a Change Request (CR) number.
> We may end up with multiple commits, by one or more users under
> a single CR number. When we deliver our CM folks want to be able to
> see all the files that have changed for a particular CR number. Is
> there an elegant way to do this in git?

Hi. The Gerrit code review tool comes with such a feature, explained on
this page:
http://gerrit.googlecode.com/svn/documentation/2.2.0/user-changeid.html

Best,
-- 
Damien Wyart

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tracking changes in git with a change number....
  2011-07-11 17:29 Tracking changes in git with a change number Rice, James M CIV NSWCDD, K73
  2011-07-12  5:37 ` Damien Wyart
@ 2011-07-12  5:50 ` Jeff King
  2011-07-12 12:54   ` Stephen Bash
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2011-07-12  5:50 UTC (permalink / raw)
  To: Rice, James M CIV NSWCDD, K73; +Cc: git

On Mon, Jul 11, 2011 at 01:29:52PM -0400, Rice, James M CIV NSWCDD, K73 wrote:

> Restating the problem.  I wish for our developers to be able to
> reference multiple commits with one number, and then find those
> commits via that number.  And I don't mind scripting to accomplish
> this.  I know, that CR # can be put in the commit message, then I can
> grep and parse the log, that is the hard way.

There are two ways to approach this: tell the CM tool about some git
commits, or tell some git commits about the CR number.

For telling the CM tool about git commits, refer to them by their sha1
commit ids.  If the commits are sequential, you can refer to the
sequence by its endpoints. And then if you want to know which files were
touched, you can just diff the endpoints, like:

  $ git diff-tree --name-only $start $end

It's not a number, exactly, but it is a fixed size (two 40-byte commit
ids). Would that work in your CM tool?

If the commits aren't sequential, you can do something similar, but you
have a variable-length list of commit ids, and you get the set of
changed files like:

  $ for i in $commits; do
      git diff-tree --name-only $i |
      tail -n +2
    done | sort -u

If you want to do the reverse and tell git about CR numbers, then I
don't think you have much option besides putting them in the commit
message. Which means you'll need to grep to get them out. You can do
something like:

  $ git log --grep='CR#' --pretty=format: --name-only

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tracking changes in git with a change number....
  2011-07-12  5:50 ` Jeff King
@ 2011-07-12 12:54   ` Stephen Bash
  2011-07-12 21:28     ` Rice, James M CIV NSWCDD, K73
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Bash @ 2011-07-12 12:54 UTC (permalink / raw)
  To: Jeff King; +Cc: git, James M CIV NSWCDD Rice, K73

----- Original Message -----
> From: "Jeff King" <peff@peff.net>
> Sent: Tuesday, July 12, 2011 1:50:08 AM
> Subject: Re: Tracking changes in git with a change number....
> 
> > Restating the problem. I wish for our developers to be able to
> > reference multiple commits with one number, and then find those
> > commits via that number. And I don't mind scripting to accomplish
> > this. I know, that CR # can be put in the commit message, then I can
> > grep and parse the log, that is the hard way.
> 
> There are two ways to approach this: tell the CM tool about some git
> commits, or tell some git commits about the CR number.
>
> ... snip ...
> 
> If you want to do the reverse and tell git about CR numbers, then I
> don't think you have much option besides putting them in the commit
> message. Which means you'll need to grep to get them out. You can do
> something like:
> 
> $ git log --grep='CR#' --pretty=format: --name-only

To add to what Jeff said, in our office we automate the 'grep' step using a git post-receive hook in our central/canonical repo.  We happen to be using Trac for issue tracking, so the post-receive hook enumerates the new commit ids, calls Trac to parse the commit messages, and Trac then updates the appropriate tickets.  But I've seen the same done with many different issue trackers.

Thanks,
Stephen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Tracking changes in git with a change number....
  2011-07-12 12:54   ` Stephen Bash
@ 2011-07-12 21:28     ` Rice, James M CIV NSWCDD, K73
  0 siblings, 0 replies; 5+ messages in thread
From: Rice, James M CIV NSWCDD, K73 @ 2011-07-12 21:28 UTC (permalink / raw)
  To: Stephen Bash, Jeff King; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]



> -----Original Message-----
> From: Stephen Bash [mailto:bash@genarts.com]
> Sent: Tuesday, July 12, 2011 8:54
> To: Jeff King
> Cc: git@vger.kernel.org; Rice, James M CIV NSWCDD, K73
> Subject: Re: Tracking changes in git with a change number....
> 
> ----- Original Message -----
> > From: "Jeff King" <peff@peff.net>
> > Sent: Tuesday, July 12, 2011 1:50:08 AM
> > Subject: Re: Tracking changes in git with a change number....
> >
> > > Restating the problem. I wish for our developers to be able to
> > > reference multiple commits with one number, and then find those
> > > commits via that number. And I don't mind scripting to accomplish
> > > this. I know, that CR # can be put in the commit message, then I
> can
> > > grep and parse the log, that is the hard way.
> >
> > There are two ways to approach this: tell the CM tool about some git
> > commits, or tell some git commits about the CR number.
> >
> > ... snip ...
> >
> > If you want to do the reverse and tell git about CR numbers, then I
> > don't think you have much option besides putting them in the commit
> > message. Which means you'll need to grep to get them out. You can do
> > something like:
> >
> > $ git log --grep='CR#' --pretty=format: --name-only
> 
> To add to what Jeff said, in our office we automate the 'grep' step
> using a git post-receive hook in our central/canonical repo.  We happen
> to be using Trac for issue tracking, so the post-receive hook
> enumerates the new commit ids, calls Trac to parse the commit messages,
> and Trac then updates the appropriate tickets.  But I've seen the same
> done with many different issue trackers.
> 
> Thanks,
> Stephen

Unfortunately our issue tracker is used by multiple organizations, is in windows and would be a pain to integrate in that manner, if it can be done at all.

That being said, Jeff's answer was what I was looking for!  Thanks to all of you for your help!

Thanks,
James.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5194 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-12 21:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 17:29 Tracking changes in git with a change number Rice, James M CIV NSWCDD, K73
2011-07-12  5:37 ` Damien Wyart
2011-07-12  5:50 ` Jeff King
2011-07-12 12:54   ` Stephen Bash
2011-07-12 21:28     ` Rice, James M CIV NSWCDD, K73

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).