git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* getting a list of changes I commited
@ 2005-09-15 18:14 Luck, Tony
  2005-09-15 18:38 ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Luck, Tony @ 2005-09-15 18:14 UTC (permalink / raw
  To: git

I've been asked whether I can provide e-mail notification
when I take patches into my tree.  I took a look at the
existing hooks, and I don't think that I want to do this
when I first make a commit ... sometimes I back these out
again if there is a problem when I test.

So I think that what I want is to produce a list of changes
that I commited when I push a new tree out to kernel.org.
But ... such a push usually contains lots of flow-through
changes that I pulled from Linus ... so a simple:

 $ git-rev-list --no-merges newhead ^oldhead

gives a long list of changes.  I'd like to filter out
all the ones that weren't commited by me.  Is there an
argument to git-rev-list that will just print the entries
where I'm listed as the commiter, or do I have to use
"--pretty-full" and write a little script to do the trim?

Or is there some other way to do this?

-Tony

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

* Re: getting a list of changes I commited
  2005-09-15 18:14 Luck, Tony
@ 2005-09-15 18:38 ` Linus Torvalds
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2005-09-15 18:38 UTC (permalink / raw
  To: Luck, Tony; +Cc: git



On Thu, 15 Sep 2005, Luck, Tony wrote:
> 
> So I think that what I want is to produce a list of changes
> that I commited when I push a new tree out to kernel.org.
> But ... such a push usually contains lots of flow-through
> changes that I pulled from Linus ... so a simple:
> 
>  $ git-rev-list --no-merges newhead ^oldhead
> 
> gives a long list of changes.

Why not just _also_ limit it by what is already merged in my tree?

Ie just do

	git fetch linus
	git-rev-list --no-merges newhead ^oldhead ^linus

The problem with your approach:

>				 I'd like to filter out
> all the ones that weren't commited by me.  Is there an
> argument to git-rev-list that will just print the entries
> where I'm listed as the commiter, or do I have to use
> "--pretty-full" and write a little script to do the trim?

This is what "--header" (and it's zero termination) is designed for: you
can do

	git-rev-list --header --no-merges newhead ^oldhead |
		grep -z "committer .*tony\.luck"

and it will give a nice NUL-terminated output list of just your commits. 
No complex script necessary.

HOWEVER. The reason I suggest adding the ^linus instead is that I suspect
people really wants to see the development stuff, and that's what they'd
get if you just run the script often enough (and daily is certainly often
enough). Also, the "grep the committer" approach fundamentally doesn't
work if you ever plan on having sub-lieutenants that work with you and
that you use git to merge with.

But hey, that grep thing certainly works too. The output is trivial to 
parse.

(Oh, and I think "-z" is a GNU grep extension.)

			Linus

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

* RE: getting a list of changes I commited
@ 2005-09-15 19:21 Luck, Tony
  2005-09-15 19:54 ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Luck, Tony @ 2005-09-15 19:21 UTC (permalink / raw
  To: Linus Torvalds; +Cc: git

>Why not just _also_ limit it by what is already merged in my tree?

I can add the "^linus", but I think that with my workflow it
will never make a difference.  Any commits that got into your
tree with a committer line by me will already be in my "oldhead"
(how else did you get them?).  So "^oldhead ^linus" should always
be identical to "^oldhead".

>This is what "--header" (and it's zero termination) is 
>designed for:

Great ... I suspected that everything I needed was already there
(after all, all GIT problems are solvable with the right arguments to
git-rev-list!)

>	git-rev-list --header --no-merges newhead ^oldhead |
>		grep -z "committer .*tony\.luck"
>
>and it will give a nice NUL-terminated output list of just 
>your commits. 
>No complex script necessary.

But "git-shortlog" doesn't like the output from this, so I need
a script (or another tip on arguments to git commands).

>Also, the "grep the committer" approach fundamentally doesn't
>work if you ever plan on having sub-lieutenants that work with you and
>that you use git to merge with.

Oh happy day when I have sub-lieutenants :-)

-Tony

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

* RE: getting a list of changes I commited
  2005-09-15 19:21 Luck, Tony
@ 2005-09-15 19:54 ` Linus Torvalds
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2005-09-15 19:54 UTC (permalink / raw
  To: Luck, Tony, Junio C Hamano; +Cc: Git Mailing List



On Thu, 15 Sep 2005, Luck, Tony wrote:
> 
> I can add the "^linus", but I think that with my workflow it
> will never make a difference.  Any commits that got into your
> tree with a committer line by me will already be in my "oldhead"
> (how else did you get them?).  So "^oldhead ^linus" should always
> be identical to "^oldhead".

No. "oldhead" has to be the point where you did the last email thing.

So any time you merge from me, next time your email cron-job (or whatever)  
hits, ^linus _will_ make a difference. Without it, you'd email out all the 
stuff that came through my tree.

> Great ... I suspected that everything I needed was already there
> (after all, all GIT problems are solvable with the right arguments to
> git-rev-list!)

Good man.

> But "git-shortlog" doesn't like the output from this, so I need
> a script (or another tip on arguments to git commands).

Ehh. This is getting ugly, but hey, that's my middle name.

	git-rev-list --header newhead ^oldhead |
		grep -z "committer .*tony\.luck" |
		tr '\0' '\n' |
		git-shortlog


and btw, this depends on "git-shortlog" also understanding non-pretty log 
messages, with a patch like below.

Junio?

		Linus "ugly" Torvalds

---
Subject: Teach git-shortlog about raw log format too

This teaches "git-shortlog" to understand the non-prettified author format 
too, so you can use it with "--pretty=raw" or "--header" output too.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/git-shortlog.perl b/git-shortlog.perl
--- a/git-shortlog.perl
+++ b/git-shortlog.perl
@@ -108,7 +108,7 @@ sub changelog_input {
 		if ($pstate == 1) {
 			my ($email);
 
-			next unless /^Author: (.*)<(.*)>.*$/;
+			next unless /^Author: (.*)<(.*)>.*$/ || /^author (.*)<(.*)>.*$/;
 	
 			$n_records++;
 	

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

* RE: getting a list of changes I commited
@ 2005-09-15 20:23 Luck, Tony
  0 siblings, 0 replies; 6+ messages in thread
From: Luck, Tony @ 2005-09-15 20:23 UTC (permalink / raw
  To: Linus Torvalds, Junio C Hamano; +Cc: Git Mailing List

>No. "oldhead" has to be the point where you did the last email thing.
>
>So any time you merge from me, next time your email cron-job (or whatever)  
>hits, ^linus _will_ make a difference. Without it, you'd email out all the 
>stuff that came through my tree.

I'm planning on doing this as part of my "push" script.  So
the oldhead is what is already up on kernel.org (which is when
I will have done the previous e-mail).  My "newhead" will be
full of stuff I got from your tree ... but most of the things
I pull from you were commited by someone else, so the "grep -z"
will drop them on the floor.  So there are just a few that have
my commit line on them ... but these *must* have come from my tree
(unless someone else is putting my name on commits!). That leaves
me with just my new commits for the e-mail.

>	git-rev-list --header newhead ^oldhead |
>		grep -z "committer .*tony\.luck" |
>		tr '\0' '\n' |
>		git-shortlog

I figured out the "tr" part myself.  That's when I saw that git-shortlog
expected to find "^Author:" and was getting "^author".

-Tony

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

* RE: getting a list of changes I commited
@ 2005-09-16  0:13 Luck, Tony
  0 siblings, 0 replies; 6+ messages in thread
From: Luck, Tony @ 2005-09-16  0:13 UTC (permalink / raw
  To: Linus Torvalds; +Cc: git

>Why not just _also_ limit it by what is already merged in my tree?
>
>Ie just do
>
>	git fetch linus
>	git-rev-list --no-merges newhead ^oldhead ^linus

Doh!  Ok, now I see that you mean _instead_ (of trying to select by
committer) rather than _also_.

That is a whole lot simpler!

-Tony

[But finding out what I committed between two releases is also
useful for status report writing purposes, so this has been a
a useful learning exercise]

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

end of thread, other threads:[~2005-09-16  0:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-16  0:13 getting a list of changes I commited Luck, Tony
  -- strict thread matches above, loose matches on Subject: below --
2005-09-15 20:23 Luck, Tony
2005-09-15 19:21 Luck, Tony
2005-09-15 19:54 ` Linus Torvalds
2005-09-15 18:14 Luck, Tony
2005-09-15 18:38 ` Linus Torvalds

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).