From: Marti Raudsepp <marti@juffo.org>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] scripts/get_maintainer.pl: also find maintainers from Mercurial (hg log)
Date: Mon, 26 Oct 2009 20:27:28 +0200 [thread overview]
Message-ID: <1256581648.20338.47.camel@newn> (raw)
In-Reply-To: <1256578064.1865.96.camel@Joe-Laptop.home>
On Mon, Oct 26, 2009 at 7:27 PM, Joe Perches <joe@perches.com> wrote:
> What about using hg annotate for the git blame?
> hg annotate -c $file
Sure, I will get around to it once this patch is done.
'hg blame' without any arguments already gives the locally-unique
revision number which can be input to 'hg log -r ####' like the git
revhash. I think this would be the way to go.
> Is there an hg annotate select line range capability?
No, but -l adds line numbers to output, so it can be filtered in Perl.
> I'm not a user of hg. I did:
> hg annotate -c -l README
> and the output line numbering style isn't clear to me.
It seems they reflect the line number in the original revision, the
documentation isn't clear on this; I will investigate it.
I guess we can get the real line number using a counter anyway.
> Maybe it's better not to introduce more arguments.
> Would it be acceptable to use --git instead of --hg
> and just execute hg if .git wasn't available but .hg
> was? Basically just consider --git the equivalent of
> --vcs and execute whatever vcs system was supported?
>
> Or maybe just add --vcs instead of --hg so that
> the perforce/cvs/svn/darcs/VisualSourceSafe/etc users
> could be happy in the future too...
I'm split on this. At first it seems adding a --vcs as an alias to --git
would make the most sense.
But that's confusing because there already is a --scm option. Also
renaming all existing --git-* options doesn't sound like a good idea.
Since will do the right thing by default, sticking with --git/--nogit
might be the best way to go.
Marti
---
scripts/get_maintainer.pl: also find maintainers from Mercurial (hg log)
When a .git directory doesn't exist, get_maintainer now tries to use Mercurial
instead.
The --nogit option also disables Mercurial.
Signed-off-by: Marti Raudsepp <marti@juffo.org>
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -30,6 +30,7 @@
my $email_git_min_percent = 5;
my $email_git_since = "1-year-ago";
my $email_git_blame = 0;
+my $email_hg_date = "-365";
my $email_remove_duplicates = 1;
my $output_multiline = 1;
my $output_separator = ", ";
@@ -72,6 +73,7 @@
'git-min-percent=i' => \$email_git_min_percent,
'git-since=s' => \$email_git_since,
'git-blame!' => \$email_git_blame,
+ 'hg-date=s' => \$email_hg_date,
'remove-duplicates!' => \$email_remove_duplicates,
'm!' => \$email_maintainer,
'n!' => \$email_usename,
@@ -278,7 +280,7 @@
}
if ($email && $email_git) {
- recent_git_signoffs($file);
+ recent_vcs_signoffs($file);
}
if ($email && $email_git_blame) {
@@ -360,13 +362,14 @@
MAINTAINER field selection options:
--email => print email address(es) if any
- --git => include recent git \*-by: signers
+ --git => include recent git or hg \*-by: signers
--git-chief-penguins => include ${penguin_chiefs}
--git-min-signatures => number of signatures required (default: 1)
--git-max-maintainers => maximum maintainers to add (default: 5)
--git-min-percent => minimum percentage of commits required (default: 5)
--git-since => git history to use (default: 1-year-ago)
--git-blame => use git blame to find modified commits for patch or file
+ --hg-date => hg history to use (default: -365)
--m => include maintainer(s) if any
--n => include name 'Full Name <addr\@domain.tld>'
--l => include list(s) if any
@@ -661,7 +664,7 @@
return @lines;
}
-sub recent_git_signoffs {
+sub recent_vcs_signoffs {
my ($file) = @_;
my $sign_offs = "";
@@ -672,18 +675,26 @@
my %hash;
my $total_sign_offs;
- if (which("git") eq "") {
- warn("$P: git not found. Add --nogit to options?\n");
- return;
- }
- if (!(-d ".git")) {
- warn("$P: .git directory not found. Use a git repository for better results.\n");
+ if (-d ".git") {
+ if (which("git") eq "") {
+ warn("$P: found .git directory but git is not installed. Use --nogit?\n");
+ return;
+ }
+
+ $cmd = "git log --since=${email_git_since} -- ${file}";
+ } elsif (-d ".hg") {
+ if (which("hg") eq "") {
+ warn("$P: found .hg directory but Mercurial is not installed. Use --nogit?\n");
+ return;
+ }
+
+ $cmd = "hg log --date=${email_hg_date} --template='{desc}\\n' -- ${file}";
+ } else {
+ warn("$P: .git or .hg directory not found. Use a git repository for better results.\n");
warn("$P: perhaps 'git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git'\n");
return;
}
- $cmd = "git log --since=${email_git_since} -- ${file}";
-
$output = `${cmd}`;
$output =~ s/^\s*//gm;
next prev parent reply other threads:[~2009-10-26 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 16:04 [RFC] scripts/get_maintainer.pl: also find maintainers from Mercurial (hg log) Marti Raudsepp
2009-10-26 17:27 ` Joe Perches
2009-10-26 18:27 ` Marti Raudsepp [this message]
2009-10-26 18:53 ` Joe Perches
2009-10-26 19:07 ` Marti Raudsepp
2009-10-29 19:23 ` [PATCH] scripts/get_maintainer.pl: Support multiple VCSs - add mercurial Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1256581648.20338.47.camel@newn \
--to=marti@juffo.org \
--cc=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.