From: Eric Wong <normalperson@yhbt.net>
To: git list <git@vger.kernel.org>, Junio C Hamano <junkio@cox.net>
Subject: [PATCH] git-svn: ensure fetch always works chronologically.
Date: Thu, 16 Feb 2006 18:13:32 -0800 [thread overview]
Message-ID: <20060217021332.GA11061@Muzzle> (raw)
In-Reply-To: <20060216194751.GB4446@Muzzle>
We run svn log against a URL without a working copy for the first fetch,
so we end up a log that's sorted from highest to lowest. That's bad, we
always want lowest to highest. Just default to --revision 0:HEAD now if
-r isn't specified for the first fetch.
Also sort the revisions after we get them just in case somebody
accidentally reverses the argument to --revision for whatever reason.
Thanks again to Emmanuel Guerin for helping me find this.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
contrib/git-svn/git-svn | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
2ec4f205eaa3914a64205ea224292b9e27e06cdf
diff --git a/contrib/git-svn/git-svn b/contrib/git-svn/git-svn
index ddd9579..2caf057 100755
--- a/contrib/git-svn/git-svn
+++ b/contrib/git-svn/git-svn
@@ -168,14 +168,15 @@ sub fetch {
my (@parents) = @_;
$SVN_URL ||= file_to_s("$GIT_DIR/$GIT_SVN/info/url");
my @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);
- if (-d $SVN_WC && !$_revision) {
- $_revision = 'BASE:HEAD';
+ unless ($_revision) {
+ $_revision = -d $SVN_WC ? 'BASE:HEAD' : '0:HEAD';
}
- push @log_args, "-r$_revision" if $_revision;
+ push @log_args, "-r$_revision";
push @log_args, '--stop-on-copy' unless $_no_stop_copy;
eval { require XML::Simple or croak $! };
my $svn_log = $@ ? svn_log_raw(@log_args) : svn_log_xml(@log_args);
+ @$svn_log = sort { $a->{revision} <=> $b->{revision} } @$svn_log;
my $base = shift @$svn_log or croak "No base revision!\n";
my $last_commit = undef;
--
1.2.0.gdee6
prev parent reply other threads:[~2006-02-17 2:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-16 7:38 [ANNOUNCE] git-svn - bidirection operations between svn and git Eric Wong
2006-02-16 8:01 ` Junio C Hamano
2006-02-16 8:08 ` Aneesh Kumar
2006-02-16 8:19 ` Junio C Hamano
2006-02-16 8:30 ` Aneesh Kumar
2006-02-16 9:20 ` Junio C Hamano
2006-02-16 11:20 ` Aneesh Kumar
2006-02-16 11:57 ` Petr Baudis
2006-02-16 12:01 ` Aneesh Kumar
2006-02-16 8:48 ` Eric Wong
2006-02-16 13:42 ` Eduardo Pereira Habkost
2006-02-16 19:25 ` Eric Wong
[not found] ` <43F4A4B1.4010307@blairos.org>
[not found] ` <20060216190426.GC12055@hand.yhbt.net>
[not found] ` <43F4CF5E.1010700@blairos.org>
[not found] ` <20060216194532.GA4446@Muzzle>
2006-02-16 19:47 ` [PATCH] git-svn: fix revision order when XML::Simple is not loaded Eric Wong
2006-02-16 21:44 ` Eric Wong
2006-02-17 2:13 ` Eric Wong [this message]
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=20060217021332.GA11061@Muzzle \
--to=normalperson@yhbt.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).