* gitweb filter for patches by a specific person in a specific timeframe
@ 2006-08-28 12:59 Kai Blin
2006-08-28 13:13 ` Jakub Narebski
2006-08-28 18:16 ` Jeff King
0 siblings, 2 replies; 7+ messages in thread
From: Kai Blin @ 2006-08-28 12:59 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 773 bytes --]
Hi folks,
I have just completed my Google Summer of Code[1] project[2] working for the
Wine project. Now, as I was submitting patches to a git repository, I don't
have a branch solely containing my patches or something like that. Google
seems to want something like this, so I figured maybe I could get gitweb to
filter for my patches during the SoC period. Is that possible?
If not, does it sound like something feasible to add?
Cheers,
Kai
PS: Please CC me, as I'm not on the list.
[1] http://code.google.com/soc/
[2] http://wiki.winehq.org/NtlmSigningAndSealing
--
Kai Blin, <kai Dot blin At gmail Dot com>
WorldForge developer http://www.worldforge.org/
Wine developer http://wiki.winehq.org/KaiBlin/
--
Will code for cotton.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gitweb filter for patches by a specific person in a specific timeframe
2006-08-28 12:59 gitweb filter for patches by a specific person in a specific timeframe Kai Blin
@ 2006-08-28 13:13 ` Jakub Narebski
2006-08-28 18:16 ` Jeff King
1 sibling, 0 replies; 7+ messages in thread
From: Jakub Narebski @ 2006-08-28 13:13 UTC (permalink / raw)
To: Kai Blin, git
Kai Blin wrote:
> I have just completed my Google Summer of Code[1] project[2] working for the
> Wine project. Now, as I was submitting patches to a git repository, I don't
> have a branch solely containing my patches or something like that. Google
> seems to want something like this, so I figured maybe I could get gitweb to
> filter for my patches during the SoC period. Is that possible?
> If not, does it sound like something feasible to add?
It is possible. Simply enter "author:Kai Blin" (without space between ':'
and your name as it appears in author field) in the searchbox, and you
would get an URL similar to the URL below:
http://www.kernel.org/git/?p=git%2Fgit.git&a=search&h=HEAD&s=author%3AJonas+Fonseca
Of course you should first go to proper branch. If you are giving the link,
you can write it in more human-friendly form, e.g.
http://www.kernel.org/git/?p=git/git.git;a=search;h=HEAD;s=author:Jonas+Fonseca
Or you can just search for your name, which gives URL like this one
http://www.kernel.org/git/?p=git/git.git;a=search;h=HEAD;s=Jonas+Fonseca
which will find all commits in the lineage of given branch (HEAD is
the current branch) which have specified phrase in commit log (which
includes signoff lines)
> PS: Please CC me, as I'm not on the list.
You can always read the list using one of the many archives
of git@vger.kernel.org list, or using Usenet (news) client via NNTP
gateway at GMane (nntp://news.gmane.org/gmane.comp.version-control.git).
See http://git.or.cz/gitwiki/GitCommunity
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gitweb filter for patches by a specific person in a specific timeframe
2006-08-28 12:59 gitweb filter for patches by a specific person in a specific timeframe Kai Blin
2006-08-28 13:13 ` Jakub Narebski
@ 2006-08-28 18:16 ` Jeff King
2006-08-28 19:04 ` Linus Torvalds
1 sibling, 1 reply; 7+ messages in thread
From: Jeff King @ 2006-08-28 18:16 UTC (permalink / raw)
To: Kai Blin; +Cc: git
On Mon, Aug 28, 2006 at 02:59:21PM +0200, Kai Blin wrote:
> I have just completed my Google Summer of Code[1] project[2] working for the
> Wine project. Now, as I was submitting patches to a git repository, I don't
> have a branch solely containing my patches or something like that. Google
> seems to want something like this, so I figured maybe I could get gitweb to
> filter for my patches during the SoC period. Is that possible?
> If not, does it sound like something feasible to add?
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:
-- >8 --
$ cat >match-who.pl <<'EOF'
#!/usr/bin/perl
my $name = shift;
my $match = qr/$name/i;
my $commit;
while(<>) {
chomp;
next unless $_;
next if /^\s/;
my ($k, $v) = split / /, $_, 2;
if($k eq 'commit') {
$commit = $v;
}
if($commit && ($k eq 'author' || $k eq 'committer') && $v =~ $match) {
print "$commit\n";
$commit = undef;
}
}
-- >8 --
Then you should be able to do:
$ git-rev-list --pretty=raw master |
perl match-who.pl kai.blin@gmail.com |
git-diff-tree -p --stdin --pretty=email \
> my-patches
You can either look through that, or you can try applying the patches
with git-am (though if your patches depend on changes not by you that
happened in the intervening time, you'll probably have some rejects).
-Peff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gitweb filter for patches by a specific person in a specific timeframe
2006-08-28 18:16 ` Jeff King
@ 2006-08-28 19:04 ` Linus Torvalds
2006-08-31 22:57 ` [PATCH] Support author and commiter based revision list limiting Jonas Fonseca
2006-09-18 0:40 ` git log --author='Jeff King' Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: Linus Torvalds @ 2006-08-28 19:04 UTC (permalink / raw)
To: Jeff King; +Cc: Kai Blin, git
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)) {
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] Support author and commiter based revision list limiting
2006-08-28 19:04 ` Linus Torvalds
@ 2006-08-31 22:57 ` Jonas Fonseca
2006-09-01 0:07 ` Junio C Hamano
2006-09-18 0:40 ` git log --author='Jeff King' Junio C Hamano
1 sibling, 1 reply; 7+ messages in thread
From: Jonas Fonseca @ 2006-08-31 22:57 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Jeff King, Kai Blin, git
Adds the two options: --author=string and --committer=string, which can
be used to limit the set of interesting commits to the ones matching the
given idents.
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
[ On top of the git-rev-list(1) update posted earlier ... ]
Linus Torvalds <torvalds@osdl.org> wrote Mon, Aug 28, 2006:
> Th[e] 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)
Hereby serving one patch doing the trivial thing very stupid, since I
didn't have the imagination to go and hunt for the bonus points just
yet.
Documentation/git-rev-list.txt | 6 +++++
builtin-rev-list.c | 3 ++
revision.c | 53 ++++++++++++++++++++++++++++++++++++++++
revision.h | 2 ++
4 files changed, 63 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index d6c86db..4d5f5ab 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -12,6 +12,8 @@ SYNOPSIS
'git-rev-list' [ \--max-count=number ]
[ \--max-age=timestamp ]
[ \--min-age=timestamp ]
+ [ \--author=string ]
+ [ \--committer=string ]
[ \--sparse ]
[ \--no-merges ]
[ \--remove-empty ]
@@ -153,6 +155,10 @@ limiting may be applied.
Limit the commits output to specified time range.
+--author='string', --committer='string'::
+
+ Limit the commits output to specified author and/or committer.
+
--remove-empty::
Stop when a given path disappears from the tree.
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 402af8e..09e3d37 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -352,7 +352,8 @@ int cmd_rev_list(int argc, const char **
revs.diff)
usage(rev_list_usage);
- save_commit_buffer = revs.verbose_header;
+ if (!revs.author_pattern && !revs.committer_pattern)
+ save_commit_buffer = revs.verbose_header;
track_object_refs = 0;
if (bisect_list)
revs.limited = 1;
diff --git a/revision.c b/revision.c
index b588f74..31618fe 100644
--- a/revision.c
+++ b/revision.c
@@ -671,6 +671,14 @@ int setup_revisions(int argc, const char
revs->min_age = approxidate(arg + 8);
continue;
}
+ if (!strncmp(arg, "--author=", 9)) {
+ revs->author_pattern = arg + 9;
+ continue;
+ }
+ if (!strncmp(arg, "--committer=", 12)) {
+ revs->committer_pattern = arg + 12;
+ continue;
+ }
if (!strcmp(arg, "--all")) {
handle_all(revs, flags);
continue;
@@ -1015,6 +1023,47 @@ static void mark_boundary_to_show(struct
}
}
+static int commit_match_ident(struct commit *commit, const char *field, const char *pattern)
+{
+ const char *pos;
+ int field_len;
+ int pattern_len;
+
+ if (!pattern)
+ return 1;
+
+ field_len = strlen(field);
+ pattern_len = strlen(pattern);
+
+ for (pos = commit->buffer; *pos != '\n'; pos++) {
+ const char *line_end = strchr(pos, '\n');
+
+ if (!strncmp(pos, field, field_len) &&
+ pos[field_len] == ' ') {
+ const char *ident_end = line_end;
+
+ pos += field_len;
+ while (ident_end > pos && ident_end[-1] != '>')
+ ident_end--;
+
+ /* A slow "strncasestr" */
+ while (pos + pattern_len <= ident_end) {
+ if (!strncasecmp(pos, pattern, pattern_len))
+ return 1;
+ pos++;
+ }
+
+ /* Assumes that fields that should be matched only
+ * appear once in the commit header. */
+ return 0;
+ }
+
+ pos = line_end;
+ }
+
+ return 0;
+}
+
struct commit *get_revision(struct rev_info *revs)
{
struct commit_list *list = revs->commits;
@@ -1074,6 +1123,10 @@ struct commit *get_revision(struct rev_i
if (revs->no_merges &&
commit->parents && commit->parents->next)
continue;
+ if (!commit_match_ident(commit, "author", revs->author_pattern))
+ continue;
+ if (!commit_match_ident(commit, "committer", revs->committer_pattern))
+ continue;
if (revs->prune_fn && revs->dense) {
/* Commit without changes? */
if (!(commit->object.flags & TREECHANGE)) {
diff --git a/revision.h b/revision.h
index d289781..7688e3a 100644
--- a/revision.h
+++ b/revision.h
@@ -71,6 +71,8 @@ struct rev_info {
int max_count;
unsigned long max_age;
unsigned long min_age;
+ const char *author_pattern;
+ const char *committer_pattern;
/* diff info for patches and for paths limiting */
struct diff_options diffopt;
--
1.4.2.g2ba6b-dirty
--
Jonas Fonseca
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Support author and commiter based revision list limiting
2006-08-31 22:57 ` [PATCH] Support author and commiter based revision list limiting Jonas Fonseca
@ 2006-09-01 0:07 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2006-09-01 0:07 UTC (permalink / raw)
To: Jonas Fonseca; +Cc: git
Jonas Fonseca <fonseca@diku.dk> writes:
> Adds the two options: --author=string and --committer=string, which can
> be used to limit the set of interesting commits to the ones matching the
> given idents.
>
> diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
> index d6c86db..4d5f5ab 100644
> --- a/Documentation/git-rev-list.txt
> +++ b/Documentation/git-rev-list.txt
> @@ -12,6 +12,8 @@ SYNOPSIS
> 'git-rev-list' [ \--max-count=number ]
> [ \--max-age=timestamp ]
> [ \--min-age=timestamp ]
> + [ \--author=string ]
> + [ \--committer=string ]
> [ \--sparse ]
> [ \--no-merges ]
> [ \--remove-empty ]
These two separate options are Ok at the level of front-end,
but...
> diff --git a/builtin-rev-list.c b/builtin-rev-list.c
> index 402af8e..09e3d37 100644
> --- a/builtin-rev-list.c
> +++ b/builtin-rev-list.c
> @@ -352,7 +352,8 @@ int cmd_rev_list(int argc, const char **
> revs.diff)
> usage(rev_list_usage);
>
> - save_commit_buffer = revs.verbose_header;
> + if (!revs.author_pattern && !revs.committer_pattern)
> + save_commit_buffer = revs.verbose_header;
> track_object_refs = 0;
> if (bisect_list)
> revs.limited = 1;
I wonder if it is simpler and yet more powerful to internally
use a regex to match the contents of commit buffer, not just
specific its header fields.
When --author or --committer is given, you internally synthesize
a regex "^author Jonas Fonseca <fonseca@" from the string.
And then, instead of doing commit_match_ident() twice like this:
> @@ -1074,6 +1123,10 @@ struct commit *get_revision(struct rev_i
> if (revs->no_merges &&
> commit->parents && commit->parents->next)
> continue;
> + if (!commit_match_ident(commit, "author", revs->author_pattern))
> + continue;
> + if (!commit_match_ident(commit, "committer", revs->committer_pattern))
> + continue;
you would just do:
if (revs->commit_filter_pattern &&
commit_search_message(commit, revs->commit_filter_pattern))
continue;
instead.
For an extra bonus point, the matching logic might want to steal
from builtin-grep to allow multiple regular expressions, case
insensitive match and other bells and whistles. You probably
could lift the whole grep_buffer() -- add another option that
behaves similarly to opt->name_only (name it opt->status_only)
but make it not even print anything upon hit, so that you can
tell from the return value if it found the pattern in the
buffer, like this:
diff --git a/builtin-grep.c b/builtin-grep.c
index 8213ce2..714ad50 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -128,6 +128,7 @@ struct grep_opt {
unsigned linenum:1;
unsigned invert:1;
unsigned name_only:1;
+ unsigned status_only:1;
unsigned unmatch_name_only:1;
unsigned count:1;
unsigned word_regexp:1;
@@ -492,6 +493,8 @@ static int grep_buffer(struct grep_opt *
}
if (hit) {
count++;
+ if (opt->status_only)
+ return 1;
if (binary_match_only) {
printf("Binary file %s matches\n", name);
return 1;
Hmm?
^ permalink raw reply related [flat|nested] 7+ messages in thread
* git log --author='Jeff King'
2006-08-28 19:04 ` Linus Torvalds
2006-08-31 22:57 ` [PATCH] Support author and commiter based revision list limiting Jonas Fonseca
@ 2006-09-18 0:40 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2006-09-18 0:40 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git, Kai Blin, Jeff King
I have three patch series that makes a part of git-grep
available and use it for log filtering:
[PATCH] builtin-grep: make pieces of it available as library.
[PATCH] revision traversal: prepare for commit log match.
[PATCH] revision traversal: --author, --committer, and --grep.
I didn't implement the boolean combination of patterns like
git-grep does, but it should be pretty straightforward to do so
in setup_revisions(). The syntax probably would be something
like:
git log --grep-( rev-list gitweb --and --not --author=Jakub --grep-)
to find logs that:
* talk about rev-list, or
* talk about gitweb but not by Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-09-18 0:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 12:59 gitweb filter for patches by a specific person in a specific timeframe Kai Blin
2006-08-28 13:13 ` Jakub Narebski
2006-08-28 18:16 ` Jeff King
2006-08-28 19:04 ` Linus Torvalds
2006-08-31 22:57 ` [PATCH] Support author and commiter based revision list limiting Jonas Fonseca
2006-09-01 0:07 ` Junio C Hamano
2006-09-18 0:40 ` git log --author='Jeff King' Junio C Hamano
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 NNTP newsgroup(s).