Re: gitweb filter for patches by a specific person in a specific timeframe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 28 Aug 2006, Jeff King wrote:
> 
> You can create an mbox of all of the changes you made. Unfortunately
> git-rev-list doesn't do author/committer matching, so you'll need a
> short perl script:

The author/committer matching is something that people have talked about 
for a long time, so maybe we should just add it? 

It shouldn't be that hard at all. Just add logic to revision.c: 
get_revision(), something like the appended (fleshed out and fixed, of 
course, with all the command line flags added to actually allow setting of 
"revs->author_pattern" etc..)

A good thing for some beginning git hacker to try doing. Hint, hint.

(The only subtle thing might be to make sure that "save_commit_buffer" is 
set if author/committer matching is on, so that the "commit->buffer" thing 
is actually saved after parsing, so that you can match it)

This trivial approach doesn't allow "gitk" to show the results sanely, 
though (to do that, you'd need to make the commit matching be part of the 
parent simplification instead - that would be extra bonus points for the 
intrpid git hacker-wannabe)

		Linus
---

diff --git a/revision.c b/revision.c
index 1d89d72..88cc1e3 100644
--- a/revision.c
+++ b/revision.c
@@ -1011,6 +1011,13 @@ static void mark_boundary_to_show(struct
 	}
 }
 
+static int commit_match(struct commit *commit, const char *field, const char *pattern)
+{
+	if (!pattern)
+		return 1;
+	.. match it here ..
+}
+
 struct commit *get_revision(struct rev_info *revs)
 {
 	struct commit_list *list = revs->commits;
@@ -1070,6 +1077,10 @@ struct commit *get_revision(struct rev_i
 		if (revs->no_merges &&
 		    commit->parents && commit->parents->next)
 			continue;
+		if (!commit_match(commit, "author", revs->author_pattern))
+			continue;
+		if (!commit_match(commit, "committer", revs->committer_pattern))
+			continue;
 		if (revs->prune_fn && revs->dense) {
 			/* Commit without changes? */
 			if (!(commit->object.flags & TREECHANGE)) {
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]