aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-02-13 17:09:40 -0800
committerEric Wong <normalperson@yhbt.net>2007-02-23 00:57:12 -0800
commit3bc718ba66f8b101b4017e778138660d66829312 (patch)
tree7c545c464288d64647fe370b3d5e355a7ed44c46
parentce207c7ad1604c6afd5014051641e40f346a59c6 (diff)
downloadgit-3bc718ba66f8b101b4017e778138660d66829312.tar.gz
git-3bc718ba66f8b101b4017e778138660d66829312.tar.xz
git-svn: usability fixes for the 'git svn log' command
Similar in spirit to the recent dcommit change, we now look at 'HEAD' by default to look for a GIT_SVN_ID so the user won't have to pass -i <GIT_SVN_ID> argument. We are also more tolerant of of people passing bare remote names as a result (just $GIT_SVN_ID without the -i) Signed-off-by: Eric Wong <normalperson@yhbt.net>
-rwxr-xr-xgit-svn.perl23
1 files changed, 20 insertions, 3 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 66653f9eb..fb2c864a3 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3033,8 +3033,25 @@ sub log_use_color {
}
sub git_svn_log_cmd {
- my ($r_min, $r_max) = @_;
- my $gs = Git::SVN->_new;
+ my ($r_min, $r_max, @args) = @_;
+ my $head = 'HEAD';
+ foreach my $x (@args) {
+ last if $x eq '--';
+ next unless ::verify_ref("$x^0");
+ $head = $x;
+ last;
+ }
+
+ my $url;
+ my ($fh, $ctx) = command_output_pipe('rev-list', $head);
+ while (<$fh>) {
+ chomp;
+ $url = (::cmt_metadata($_))[0];
+ last if defined $url;
+ }
+ close $fh; # break the pipe
+
+ my $gs = Git::SVN->find_by_url($url) || Git::SVN->_new;
my @cmd = (qw/log --abbrev-commit --pretty=raw --default/,
$gs->refname);
push @cmd, '-r' unless $non_recursive;
@@ -3227,7 +3244,7 @@ sub cmd_show_log {
}
config_pager();
- @args = (git_svn_log_cmd($r_min, $r_max), @args);
+ @args = (git_svn_log_cmd($r_min, $r_max, @args), @args);
my $log = command_output_pipe(@args);
run_pager();
my (@k, $c, $d);