git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org, Steven Walter <stevenrwalter@gmail.com>
Subject: Re: [PATCH] Don't checkout the full tree if avoidable
Date: Mon, 01 Oct 2007 00:58:48 -0700	[thread overview]
Message-ID: <7vejgftgef.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1191000259190-git-send-email-stevenrwalter@gmail.com> (Steven Walter's message of "Fri, 28 Sep 2007 13:24:19 -0400")

Steven Walter <stevenrwalter@gmail.com> writes:

> In most cases of branching, the tree is copied unmodified from the trunk
> to the branch.  When that is done, we can simply start with the parent's
> index and apply the changes on the branch as usual.
>
> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>

Eric, do you like this one?

> ---
>  git-svn.perl |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 484b057..2ca2042 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -1847,6 +1847,13 @@ sub find_parent_branch {
>  			$gs->ra->gs_do_switch($r0, $rev, $gs,
>  					      $self->full_url, $ed)
>  			  or die "SVN connection failed somewhere...\n";
> +		} elsif ($self->trees_match($new_url, $r0,
> +			                    $self->full_url, $rev)) {
> +			$self->tmp_index_do(sub {
> +			    command_noisy('read-tree', $parent);
> +			});
> +			$self->{last_commit} = $parent;
> +			# Assume copy with no changes
>  		} else {
>  			print STDERR "Following parent with do_update\n";
>  			$ed = SVN::Git::Fetcher->new($self);
> @@ -1859,6 +1866,17 @@ sub find_parent_branch {
>  	return undef;
>  }
>  
> +sub trees_match {
> +    my ($self, $url1, $rev1, $url2, $rev2) = @_;
> +    
> +    my $ret=1;
> +    open(my $fh, "svn diff $url1\@$rev1 $url2\@$rev2 |");
> +    $ret=0 if (<$fh>);
> +    close($fh);
> +
> +    return $ret;
> +}
> +
>  sub do_fetch {
>  	my ($self, $paths, $rev) = @_;
>  	my $ed;
> -- 
> 1.5.3.1

  reply	other threads:[~2007-10-01  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28 17:24 [PATCH] Don't checkout the full tree if avoidable Steven Walter
2007-10-01  7:58 ` Junio C Hamano [this message]
2007-10-01 11:08   ` Eric Wong
2007-10-01 13:12     ` Steven Walter
2007-10-03 23:26       ` Eric Wong

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=7vejgftgef.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    --cc=stevenrwalter@gmail.com \
    /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 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).