svn import: skip initial revisions
Add a flag to skip initial revisions: some SVN repositories have initial setup cruft in their logs which we might want to ignore. Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Matthias Urlichs committed
Oct 10, 2005 at 15:14 UTC
7ee74a99b2b710b5f5adc22db2fe0aca8a74c809
2 files changed
+12
-7
Documentation/git-svnimport.txt
+6
-1
@@ -12,7 +12,7 @@ SYNOPSIS
12
'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
13
[ -C <GIT_repository> ] [ -i ] [ -u ]
14
[ -b branch_subdir ] [ -t trunk_subdir ] [ -T tag_subdir ]
15
- [ -m ] [ -M regex ] [ <SVN_repository_URL> ]
15
+ [ -s start_chg ] [ -m ] [ -M regex ] [ <SVN_repository_URL> ]
16
17
18
DESCRIPTION
@@ -36,6 +36,11 @@ OPTIONS
36
The GIT repository to import to. If the directory doesn't
37
exist, it will be created. Default is the current directory.
38
39
+-s <start_rev>::
40
+ Start importing at this SVN change number. The default is 1.
41
++
42
+When importing incementally, you might need to edit the .git/svn2git file.
43
+
44
-i::
45
Import-only: don't perform a checkout after importing. This option
46
ensures the working directory and cache remain untouched and will
git-svnimport.perl
+6
-6
@@ -31,19 +31,19 @@ die "Need CVN:COre 1.2.1 or better" if $SVN::Core::VERSION lt "1.2.1";
31
$SIG{'PIPE'}="IGNORE";
32
$ENV{'TZ'}="UTC";
33
34
-our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b);
34
+our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_s);
35
36
sub usage() {
37
print STDERR <<END;
38
Usage: ${\basename $0} # fetch/update GIT from CVS
39
[-o branch-for-HEAD] [-h] [-v]
40
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
41
- [-i] [-u] [-s subst] [-m] [-M regex] [SVN_URL]
41
+ [-i] [-u] [-s start_chg] [-m] [-M regex] [SVN_URL]
42
END
43
exit(1);
44
}
45
46
-getopts("b:C:hivmM:o:t:T:u") or usage();
46
+getopts("b:C:hivmM:o:s:t:T:u") or usage();
47
usage if $opt_h;
48
49
my $tag_name = $opt_t || "tags";
@@ -192,7 +192,7 @@ $ENV{GIT_INDEX_FILE} = $git_index;
192
my $maxnum = 0;
193
my $last_rev = "";
194
my $last_branch;
195
-my $current_rev = 0;
195
+my $current_rev = $opt_s ? ($opt_s-1) : 0;
196
unless(-d $git_dir) {
197
system("git-init-db");
198
die "Cannot init the GIT db at $git_tree: $?\n" if $?;
@@ -364,7 +364,7 @@ sub commit {
364
}
365
366
my $rev;
367
- if(defined $parent) {
367
+ if($revision > $opt_s and defined $parent) {
368
open(H,"git-rev-parse --verify $parent |");
369
$rev = <H>;
370
close(H) or do {
@@ -377,7 +377,7 @@ sub commit {
377
return;
378
}
379
$rev = $branches{($parent eq $opt_o) ? "/" : $parent}{"LAST"};
380
- if($revision != 1 and not $rev) {
380
+ if($revision != $opt_s and not $rev) {
381
print STDERR "$revision: do not know ancestor for '$parent'!\n";
382
return;
383
}