git-svn: --branch-all-refs / -B support
This should make life easier for all those who type: `git-rev-parse --symbolic --all | xargs -n1 echo -b` every time they run git-svn fetch. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong committed
Apr 28, 2006 at 03:42 UTC
bf78b1d89b29f8524ccfbd7042fa277277e316ff
1 file changed
+14
-1
contrib/git-svn/git-svn.perl
+14
-1
@@ -34,12 +34,13 @@ my $sha1 = qr/[a-f\d]{40}/;
34
my $sha1_short = qr/[a-f\d]{4,40}/;
35
my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
36
$_find_copies_harder, $_l, $_cp_similarity,
37
- $_version, $_upgrade, $_authors);
37
+ $_version, $_upgrade, $_authors, $_branch_all_refs);
38
my (@_branch_from, %tree_map, %users);
39
my ($_svn_co_url_revs, $_svn_pg_peg_revs);
40
41
my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
42
'branch|b=s' => \@_branch_from,
43
+ 'branch-all-refs|B' => \$_branch_all_refs,
44
'authors-file|A=s' => \$_authors );
45
46
# yes, 'native' sets "\n". Patches to fix this for non-*nix systems welcome:
@@ -108,6 +109,7 @@ usage(0) if $_help;
109
version() if $_version;
110
usage(1) unless defined $cmd;
111
load_authors() if $_authors;
112
+load_all_refs() if $_branch_all_refs;
113
svn_compat_check();
114
$cmd{$cmd}->[0]->(@ARGV);
115
exit 0;
@@ -1238,6 +1240,17 @@ sub map_tree_joins {
1240
}
1241
}
1242
1243
+sub load_all_refs {
1244
+ if (@_branch_from) {
1245
+ print STDERR '--branch|-b parameters are ignored when ',
1246
+ "--branch-all-refs|-B is passed\n";
1247
+ }
1248
+
1249
+ # don't worry about rev-list on non-commit objects/tags,
1250
+ # it shouldn't blow up if a ref is a blob or tree...
1251
+ chomp(@_branch_from = `git-rev-parse --symbolic --all`);
1252
+}
1253
+
1254
# '<svn username> = real-name <email address>' mapping based on git-svnimport:
1255
sub load_authors {
1256
open my $authors, '<', $_authors or die "Can't open $_authors $!\n";