From: David D Kilzer <hidden> Date: 2016-06-15 22:43:49
This patch series contains varies fixes for the "git-svn log" command:
[PATCH 1/3] git-svn log: fix ascending revision ranges
[PATCH 2/3] git-svn log: include commit log for the smallest revision in a range
[PATCH 3/3] git-svn log: handle unreachable revisions like "svn log"
I am looking for feedback since this is my first significant patch series
for git. (I posted a couple of documentation fixes and Makefile tweaks
previously.)
Thanks!
Dave
--
git-svn.perl | 60 ++++++++++++++++++++++++------------
t/t9116-git-svn-log.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 120 insertions(+), 20 deletions(-)
--
From: David D Kilzer <hidden> Date: 2016-06-15 22:43:49
The "svn log -rM:N" command shows commit logs inclusive in the range [M,N].
Previously "git-svn log" always excluded the commit log for the smallest
revision in a range, whether the range was ascending or descending. With
this patch, the smallest revision in a range is always shown.
Updated tests for ascending and descending revision ranges.
Signed-off-by: David D Kilzer <redacted>
---
git-svn.perl | 6 +++---
t/t9116-git-svn-log.sh | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
From: David D Kilzer <hidden> Date: 2016-06-15 22:43:49
When unreachable revisions are given to "svn log", it displays all commit
logs in the given range that exist in the current tree. (If no commit
logs are found in the current tree, it simply prints a single commit log
separator.) This patch makes "git-svn log" behave the same way.
Ten tests added to t/t9116-git-svn-log.sh.
Signed-off-by: David D Kilzer <redacted>
---
git-svn.perl | 58 ++++++++++++++++++++++++++++--------------
t/t9116-git-svn-log.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 19 deletions(-)
@@ -2257,9 +2257,10 @@ sub rev_db_get {}subfind_rev_before{-my($self,$rev,$eq_ok)=@_;+my($self,$rev,$eq_ok,$min_rev)=@_;--$revunless$eq_ok;-while($rev>0){+$min_rev||=1;+while($rev>=$min_rev){if(my$c=$self->rev_db_get($rev)){return($rev,$c);}
@@ -2268,6 +2269,19 @@ sub find_rev_before {return(undef,undef);}+subfind_rev_after{+my($self,$rev,$eq_ok,$max_rev)=@_;+++$revunless$eq_ok;+$max_rev||=$self->rev_db_max();+while($rev<=$max_rev){+if(my$c=$self->rev_db_get($rev)){+return($rev,$c);+}+++$rev;+}+return(undef,undef);+}+sub_new{my($class,$repo_id,$ref_id,$path)=@_;unless(defined$repo_id&&length$repo_id){
@@ -3587,19 +3601,19 @@ sub git_svn_log_cmd {push@cmd,$c;}}elsif(defined$r_max){-my($c_min,$c_max);-$c_max=$gs->rev_db_get($r_max);-$c_min=$gs->rev_db_get($r_min);-if(defined$c_min&&defined$c_max){-if($r_max>$r_min){-push@cmd,"--boundary","$c_min..$c_max";-}else{-push@cmd,"--boundary","$c_max..$c_min";-}-}elsif($r_max>$r_min){-push@cmd,$c_max;+if($r_max<$r_min){+($r_min,$r_max)=($r_max,$r_min);+}+my(undef,$c_max)=$gs->find_rev_before($r_max,1,$r_min);+my(undef,$c_min)=$gs->find_rev_after($r_min,1,$r_max);+# If there are no commits in the range, both $c_max and $c_min+# will be undefined. If there is at least 1 commit in the+# range, both will be defined.+return()if!defined$c_min;+if($c_mineq$c_max){+push@cmd,'--max-count=1',$c_min;}else{-push@cmd,$c_min;+push@cmd,'--boundary',"$c_min..$c_max";}}return(@cmd,@files);
@@ -30,6 +30,12 @@ test_expect_success 'setup repository and import' "gitreset--hardtrunk&&echoaye>>README&&gitcommit-a-maye&&+gitsvndcommit&&+gitreset--hardb&&+echospy>>README&&+gitcommit-a-mspy&&+echotry>>README&&+gitcommit-a-mtry&&gitsvndcommit"
@@ -59,4 +65,64 @@ test_expect_success 'test descending revision range' "gitsvnlog-r4:1|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-r2-r1-"+printf'r1 \nr2 \n'>expected-range-r1-r2++test_expect_success'test ascending revision range with unreachable revision'"+gitreset--hardtrunk&&+gitsvnlog-r1:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r1-r2-+"++printf'r2 \nr1 \n'>expected-range-r2-r1++test_expect_success'test descending revision range with unreachable revision'"+gitreset--hardtrunk&&+gitsvnlog-r3:1|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-r1-+"++printf'r2 \n'>expected-range-r2++test_expect_success'test ascending revision range with unreachable upper boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r2:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-+"++test_expect_success'test descending revision range with unreachable upper boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:2|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-+"++printf'r4 \n'>expected-range-r4++test_expect_success'test ascending revision range with unreachable lower boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:4|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++test_expect_success'test descending revision range with unreachable lower boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r4:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++echo------------------------------------------------------------------------>expected-separator++test_expect_success'test ascending revision range with unreachable boundary revisions and no commits'"+gitreset--hardtrunk&&+gitsvnlog-r5:6|diff-uexpected-separator-+"++test_expect_success'test descending revision range with unreachable boundary revisions and no commits'"+gitreset--hardtrunk&&+gitsvnlog-r6:5|diff-uexpected-separator-+"++test_expect_success'test ascending revision range with unreachable boundary revisions and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:5|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++test_expect_success'test descending revision range with unreachable boundary revisions and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r5:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"+ test_done
From: David D Kilzer <hidden> Date: 2016-06-15 22:43:49
Fixed typo in Git::SVN::Log::git_svn_log_cmd(). Previously a command like
"git-svn log -r1:4" would only show a commit log separator.
Added tests for ascending and descending revision ranges.
Signed-off-by: David D Kilzer <redacted>
---
git-svn.perl | 2 +-
t/t9116-git-svn-log.sh | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)
Hi David,
thanks for the patches, the series looks good to me, I added some
comments below, for this patch.
On Nov 11, 2007, at 7:10 AM, David D Kilzer wrote:
quoted hunk
When unreachable revisions are given to "svn log", it displays all
commit
logs in the given range that exist in the current tree. (If no commit
logs are found in the current tree, it simply prints a single
commit log
separator.) This patch makes "git-svn log" behave the same way.
Ten tests added to t/t9116-git-svn-log.sh.
Signed-off-by: David D Kilzer <redacted>
---
git-svn.perl | 58 +++++++++++++++++++++++++++
+--------------
t/t9116-git-svn-log.sh | 66 +++++++++++++++++++++++++++++++++++++
+++++++++++
2 files changed, 105 insertions(+), 19 deletions(-)
@@ -2257,9 +2257,10 @@ sub rev_db_get {}subfind_rev_before{-my($self,$rev,$eq_ok)=@_;+my($self,$rev,$eq_ok,$min_rev)=@_;
Could you please document this function? I guess that you had to
figure out what each argument was for, so please save the time of the
contributors that will read this code after you :)
quoted hunk
--$rev unless $eq_ok;
- while ($rev > 0) {
+ $min_rev ||= 1;
+ while ($rev >= $min_rev) {
if (my $c = $self->rev_db_get($rev)) {
return ($rev, $c);
}
Too much code duplication. It should be possible to write a sub
find_rev_ (or _find_rev, don't know what's the naming convention for
internal details) that takes a 5th argument, an anonymous sub that
does the comparison. So that basically, find_rev_before will be
something along these (untested) lines:
sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return find_rev_($self, $rev, $eq_ok, $min_rev, sub { my ($a, $b) =
@_; return $a >= $b; });
}
quoted hunk
sub _new {
my ($class, $repo_id, $ref_id, $path) = @_;
unless (defined $repo_id && length $repo_id) {
@@ -3587,19 +3601,19 @@ sub git_svn_log_cmd { push @cmd, $c; } } elsif (defined $r_max) {- my ($c_min, $c_max);- $c_max = $gs->rev_db_get($r_max);- $c_min = $gs->rev_db_get($r_min);- if (defined $c_min && defined $c_max) {- if ($r_max > $r_min) {- push @cmd, "--boundary", "$c_min..$c_max";- } else {- push @cmd, "--boundary", "$c_max..$c_min";- }- } elsif ($r_max > $r_min) {- push @cmd, $c_max;+ if ($r_max < $r_min) {+ ($r_min, $r_max) = ($r_max, $r_min);+ }+ my (undef, $c_max) = $gs->find_rev_before($r_max, 1, $r_min);+ my (undef, $c_min) = $gs->find_rev_after($r_min, 1, $r_max);+ # If there are no commits in the range, both $c_max and $c_min+ # will be undefined. If there is at least 1 commit in the+ # range, both will be defined.+ return () if !defined $c_min;
Fair enough but I'd strengthen the test by writing something like:
return () if not defined $c_min || not defined $c_max;
unless you can prove that `rev_db_get' can never return `undef' or
something like that.
This will choke on shells with buggy/fragile `echo'. I think it'd be
safer to use printf here.
Cheers,
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
From: David D. Kilzer <hidden> Date: 2016-06-15 22:43:49
Benoit Sigoure [off-list ref] wrote:
thanks for the patches, the series looks good to me, I added some
comments below, for this patch.
Thanks for the review, Benoit! Comments below.
On Nov 11, 2007, at 7:10 AM, David D Kilzer wrote:
quoted
sub find_rev_before {
- my ($self, $rev, $eq_ok) = @_;
+ my ($self, $rev, $eq_ok, $min_rev) = @_;
Could you please document this function? I guess that you had to
figure out what each argument was for, so please save the time of the
contributors that will read this code after you :)
What is the format for documenting functions in git Perl scripts? I haven't
see any "perlpod" use anywhere. Do you just want comments before the function?
This method returns the git commit hash and svn revision of the first svn
revision that exists on the current branch that is less than $rev (or
less-than-or-equal-to $rev if $eq_ok is true).
Please note that I don't have a full understanding of how find_rev_before()
works (other than it's computing an offset into a sparse? data file based on
the revision number) since I'm still new to git.
Too much code duplication. It should be possible to write a sub
find_rev_ (or _find_rev, don't know what's the naming convention for
internal details) that takes a 5th argument, an anonymous sub that
does the comparison. So that basically, find_rev_before will be
something along these (untested) lines:
sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return find_rev_($self, $rev, $eq_ok, $min_rev, sub { my ($a, $b) =
@_; return $a >= $b; });
}
I think that combining find_rev_before() and find_rev_after() would greatly
sacrifice readability of the code in exchange for removing ~10 lines of code.
Also, you must do more than just replace the comparison in the while() loop:
- before() decrements $rev while after() increments it
- stop limits are different ($max_rev versus $min_rev)
This is what such a method might look like (untested). Since you already
requested find_rev_before() be documented, is this really going to help?
sub find_rev_ {
my ($self, $rev, $eq_ok, $is_before, $limit_rev) = @_;
($is_before ? --$rev : ++$rev) unless $eq_ok;
$limit_rev ||= ($is_before ? 1 : $self->rev_db_max());
while ($is_before ? $rev >= $limit_rev : $rev <= $limit_rev) {
if (my $c = $self->rev_db_get($rev)) {
return ($rev, $c);
}
$is_before ? --$rev : ++$rev;
}
return (undef, undef);
}
Defining wrapper functions would help, but I still think it's just as clear to
keep the two methods separate.
sub find_rev_before() {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 1, $min_rev);
}
sub find_rev_after() {
my ($self, $rev, $eq_ok, $max_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 0, $max_rev);
}
Do you agree, or do you think the methods should still be combined?
quoted
+ if ($r_max < $r_min) {
+ ($r_min, $r_max) = ($r_max, $r_min);
+ }
+ my (undef, $c_max) = $gs->find_rev_before($r_max, 1, $r_min);
+ my (undef, $c_min) = $gs->find_rev_after($r_min, 1, $r_max);
+ # If there are no commits in the range, both $c_max and $c_min
+ # will be undefined. If there is at least 1 commit in the
+ # range, both will be defined.
+ return () if !defined $c_min;
Fair enough but I'd strengthen the test by writing something like:
return () if not defined $c_min || not defined $c_max;
unless you can prove that `rev_db_get' can never return `undef' or
something like that.
On Nov 11, 2007, at 3:20 PM, David D. Kilzer wrote:
Benoit Sigoure [off-list ref] wrote:
quoted
On Nov 11, 2007, at 7:10 AM, David D Kilzer wrote:
quoted
sub find_rev_before {
- my ($self, $rev, $eq_ok) = @_;
+ my ($self, $rev, $eq_ok, $min_rev) = @_;
Could you please document this function? I guess that you had to
figure out what each argument was for, so please save the time of the
contributors that will read this code after you :)
What is the format for documenting functions in git Perl scripts?
I haven't
see any "perlpod" use anywhere. Do you just want comments before
the function?
This method returns the git commit hash and svn revision of the
first svn
revision that exists on the current branch that is less than $rev (or
less-than-or-equal-to $rev if $eq_ok is true).
Personally, I don't care. Maybe Eric has his own preference. For
me, as long as the code is documented one way or another, that's fine
by me. Under-documented code hinders new contributors, so I think
it's important to add documentation whenever possible.
Please note that I don't have a full understanding of how
find_rev_before()
works (other than it's computing an offset into a sparse? data file
based on
the revision number) since I'm still new to git.
Too much code duplication. It should be possible to write a sub
find_rev_ (or _find_rev, don't know what's the naming convention for
internal details) that takes a 5th argument, an anonymous sub that
does the comparison. So that basically, find_rev_before will be
something along these (untested) lines:
sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return find_rev_($self, $rev, $eq_ok, $min_rev, sub { my ($a, $b) =
@_; return $a >= $b; });
}
I think that combining find_rev_before() and find_rev_after() would
greatly
sacrifice readability of the code in exchange for removing ~10
lines of code.
Also, you must do more than just replace the comparison in the while
() loop:
- before() decrements $rev while after() increments it
- stop limits are different ($max_rev versus $min_rev)
This is what such a method might look like (untested). Since you
already
requested find_rev_before() be documented, is this really going to
help?
sub find_rev_ {
my ($self, $rev, $eq_ok, $is_before, $limit_rev) = @_;
($is_before ? --$rev : ++$rev) unless $eq_ok;
$limit_rev ||= ($is_before ? 1 : $self->rev_db_max());
while ($is_before ? $rev >= $limit_rev : $rev <= $limit_rev) {
if (my $c = $self->rev_db_get($rev)) {
return ($rev, $c);
}
$is_before ? --$rev : ++$rev;
}
return (undef, undef);
}
Defining wrapper functions would help, but I still think it's just
as clear to
keep the two methods separate.
sub find_rev_before() {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 1, $min_rev);
}
sub find_rev_after() {
my ($self, $rev, $eq_ok, $max_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 0, $max_rev);
}
Do you agree, or do you think the methods should still be combined?
Er... you're right, I overlooked the differences between the two
functions. So merging them would make the code more complex than it
needs to be, or so I think.
Thanks!
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
From: Eric Wong <hidden> Date: 2016-06-15 22:43:49
"David D. Kilzer" [off-list ref] wrote:
Hi Dave, thanks for the patches, and thanks to Benoit for the review.
Benoit Sigoure [off-list ref] wrote:
quoted
thanks for the patches, the series looks good to me, I added some
comments below, for this patch.
Thanks for the review, Benoit! Comments below.
quoted
On Nov 11, 2007, at 7:10 AM, David D Kilzer wrote:
quoted
sub find_rev_before {
- my ($self, $rev, $eq_ok) = @_;
+ my ($self, $rev, $eq_ok, $min_rev) = @_;
Could you please document this function? I guess that you had to
figure out what each argument was for, so please save the time of the
contributors that will read this code after you :)
What is the format for documenting functions in git Perl scripts? I
haven't see any "perlpod" use anywhere. Do you just want comments
before the function?
Just a regular comment is enough, perlpod uses too much space.
This method returns the git commit hash and svn revision of the first svn
revision that exists on the current branch that is less than $rev (or
less-than-or-equal-to $rev if $eq_ok is true).
Please note that I don't have a full understanding of how find_rev_before()
works (other than it's computing an offset into a sparse? data file based on
the revision number) since I'm still new to git.
Pretty much. The .rev_db format is documented above the _rev_db_set
sub. I'm considering replacing the current rev_db format with something
more compact for larger repos, though.
Too much code duplication. It should be possible to write a sub
find_rev_ (or _find_rev, don't know what's the naming convention for
internal details) that takes a 5th argument, an anonymous sub that
does the comparison. So that basically, find_rev_before will be
something along these (untested) lines:
sub find_rev_before {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return find_rev_($self, $rev, $eq_ok, $min_rev, sub { my ($a, $b) =
@_; return $a >= $b; });
}
I think that combining find_rev_before() and find_rev_after() would greatly
sacrifice readability of the code in exchange for removing ~10 lines of code.
Also, you must do more than just replace the comparison in the while() loop:
- before() decrements $rev while after() increments it
- stop limits are different ($max_rev versus $min_rev)
This is what such a method might look like (untested). Since you already
requested find_rev_before() be documented, is this really going to help?
sub find_rev_ {
my ($self, $rev, $eq_ok, $is_before, $limit_rev) = @_;
($is_before ? --$rev : ++$rev) unless $eq_ok;
$limit_rev ||= ($is_before ? 1 : $self->rev_db_max());
while ($is_before ? $rev >= $limit_rev : $rev <= $limit_rev) {
if (my $c = $self->rev_db_get($rev)) {
return ($rev, $c);
}
$is_before ? --$rev : ++$rev;
}
return (undef, undef);
}
find_rev_ is too complicated, please keep them as separate functions.
Defining wrapper functions would help, but I still think it's just as clear to
keep the two methods separate.
sub find_rev_before() {
my ($self, $rev, $eq_ok, $min_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 1, $min_rev);
}
sub find_rev_after() {
my ($self, $rev, $eq_ok, $max_rev) = @_;
return $self->find_rev_($rev, $eq_ok, 0, $max_rev);
}
Do you agree, or do you think the methods should still be combined?
quoted
quoted
+ if ($r_max < $r_min) {
+ ($r_min, $r_max) = ($r_max, $r_min);
+ }
+ my (undef, $c_max) = $gs->find_rev_before($r_max, 1, $r_min);
+ my (undef, $c_min) = $gs->find_rev_after($r_min, 1, $r_max);
+ # If there are no commits in the range, both $c_max and $c_min
+ # will be undefined. If there is at least 1 commit in the
+ # range, both will be defined.
+ return () if !defined $c_min;
Fair enough but I'd strengthen the test by writing something like:
return () if not defined $c_min || not defined $c_max;
unless you can prove that `rev_db_get' can never return `undef' or
something like that.
I prefer '!' instead of 'not' unless operator precedence matters.
From: David D Kilzer <hidden> Date: 2016-06-15 22:43:49
When unreachable revisions are given to "svn log", it displays all commit
logs in the given range that exist in the current tree. (If no commit
logs are found in the current tree, it simply prints a single commit log
separator.) This patch makes "git-svn log" behave the same way.
Ten tests added to t/t9116-git-svn-log.sh.
Signed-off-by: David D Kilzer <redacted>
---
No changes were needed to parts 1 and 2 of this series, so I am not
reposting them.
Updated this patch based on feedback from Benoit Sigoure and Eric Wong:
- Commented find_rev_before() and find_rev_after().
- Changed commit_log_separator() into a constant.
- Made return statement safer by adding another check in git_svn_log_cmd().
- Changed echo statement to printf in t/t9116-git-svn-log.sh.
All tests pass on maint branch.
git-svn.perl | 63 ++++++++++++++++++++++++++++++++--------------
t/t9116-git-svn-log.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 19 deletions(-)
@@ -2256,10 +2256,15 @@ sub rev_db_get {$ret;}+# Finds the first svn revision that exists on (if $eq_ok is true) or+# before $rev for the current branch. It will not search any lower+# than $min_rev. Returns the git commit hash and svn revision number+# if found, else (undef, undef).subfind_rev_before{-my($self,$rev,$eq_ok)=@_;+my($self,$rev,$eq_ok,$min_rev)=@_;--$revunless$eq_ok;-while($rev>0){+$min_rev||=1;+while($rev>=$min_rev){if(my$c=$self->rev_db_get($rev)){return($rev,$c);}
@@ -2268,6 +2273,23 @@ sub find_rev_before {return(undef,undef);}+# Finds the first svn revision that exists on (if $eq_ok is true) or+# after $rev for the current branch. It will not search any higher+# than $max_rev. Returns the git commit hash and svn revision number+# if found, else (undef, undef).+subfind_rev_after{+my($self,$rev,$eq_ok,$max_rev)=@_;+++$revunless$eq_ok;+$max_rev||=$self->rev_db_max();+while($rev<=$max_rev){+if(my$c=$self->rev_db_get($rev)){+return($rev,$c);+}+++$rev;+}+return(undef,undef);+}+sub_new{my($class,$repo_id,$ref_id,$path)=@_;unless(defined$repo_id&&length$repo_id){
@@ -3587,19 +3610,19 @@ sub git_svn_log_cmd {push@cmd,$c;}}elsif(defined$r_max){-my($c_min,$c_max);-$c_max=$gs->rev_db_get($r_max);-$c_min=$gs->rev_db_get($r_min);-if(defined$c_min&&defined$c_max){-if($r_max>$r_min){-push@cmd,"--boundary","$c_min..$c_max";-}else{-push@cmd,"--boundary","$c_max..$c_min";-}-}elsif($r_max>$r_min){-push@cmd,$c_max;+if($r_max<$r_min){+($r_min,$r_max)=($r_max,$r_min);+}+my(undef,$c_max)=$gs->find_rev_before($r_max,1,$r_min);+my(undef,$c_min)=$gs->find_rev_after($r_min,1,$r_max);+# If there are no commits in the range, both $c_max and $c_min+# will be undefined. If there is at least 1 commit in the+# range, both will be defined.+return()if!defined$c_min||!defined$c_max;+if($c_mineq$c_max){+push@cmd,'--max-count=1',$c_min;}else{-push@cmd,$c_min;+push@cmd,'--boundary',"$c_min..$c_max";}}return(@cmd,@files);
@@ -30,6 +30,12 @@ test_expect_success 'setup repository and import' "gitreset--hardtrunk&&echoaye>>README&&gitcommit-a-maye&&+gitsvndcommit&&+gitreset--hardb&&+echospy>>README&&+gitcommit-a-mspy&&+echotry>>README&&+gitcommit-a-mtry&&gitsvndcommit"
@@ -59,4 +65,64 @@ test_expect_success 'test descending revision range' "gitsvnlog-r4:1|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-r2-r1-"+printf'r1 \nr2 \n'>expected-range-r1-r2++test_expect_success'test ascending revision range with unreachable revision'"+gitreset--hardtrunk&&+gitsvnlog-r1:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r1-r2-+"++printf'r2 \nr1 \n'>expected-range-r2-r1++test_expect_success'test descending revision range with unreachable revision'"+gitreset--hardtrunk&&+gitsvnlog-r3:1|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-r1-+"++printf'r2 \n'>expected-range-r2++test_expect_success'test ascending revision range with unreachable upper boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r2:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-+"++test_expect_success'test descending revision range with unreachable upper boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:2|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r2-+"++printf'r4 \n'>expected-range-r4++test_expect_success'test ascending revision range with unreachable lower boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:4|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++test_expect_success'test descending revision range with unreachable lower boundary revision and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r4:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++printf--'------------------------------------------------------------------------\n'>expected-separator++test_expect_success'test ascending revision range with unreachable boundary revisions and no commits'"+gitreset--hardtrunk&&+gitsvnlog-r5:6|diff-uexpected-separator-+"++test_expect_success'test descending revision range with unreachable boundary revisions and no commits'"+gitreset--hardtrunk&&+gitsvnlog-r6:5|diff-uexpected-separator-+"++test_expect_success'test ascending revision range with unreachable boundary revisions and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r3:5|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"++test_expect_success'test descending revision range with unreachable boundary revisions and 1 commit'"+gitreset--hardtrunk&&+gitsvnlog-r5:3|grep'^r[0-9]'|cut-d'|'-f1|diff-uexpected-range-r4-+"+ test_done
From: Eric Wong <hidden> Date: 2016-06-15 22:43:52
David D Kilzer [off-list ref] wrote:
When unreachable revisions are given to "svn log", it displays all commit
logs in the given range that exist in the current tree. (If no commit
logs are found in the current tree, it simply prints a single commit log
separator.) This patch makes "git-svn log" behave the same way.
Ten tests added to t/t9116-git-svn-log.sh.
Signed-off-by: David D Kilzer <redacted>
---
No changes were needed to parts 1 and 2 of this series, so I am not
reposting them.
Updated this patch based on feedback from Benoit Sigoure and Eric Wong:
- Commented find_rev_before() and find_rev_after().
- Changed commit_log_separator() into a constant.
- Made return statement safer by adding another check in git_svn_log_cmd().
- Changed echo statement to printf in t/t9116-git-svn-log.sh.
All tests pass on maint branch.
Thanks,
Acked and pushed out to http://git.bogomips.org/git-svn.git
David D Kilzer (3):
git-svn log: fix ascending revision ranges
git-svn log: include commit log for the smallest revision in a range
git-svn log: handle unreachable revisions like "svn log"
David Reiss (1):
git-svn: Fix a typo and add a comma in an error message in git-svn
Eric Wong (1):
git-svn: add tests for command-line usage of init and clone commands
Konstantin V. Arkhipov (1):
git-svn's dcommit must use subversion's config
--
Eric Wong