git-svn: allow metadata options to be specified with 'init' and 'clone'
Since the options that affect the way metadata is handled in git-svn, should be consistently set/unset throughout history imported by git-svn; it makes sense to allow the user to set certain options from the command-line that will write to the config file when initially creating the repository. Also, fix some formatting issues while we're updating documentation. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong committed
Feb 18, 2007 at 02:34 UTC
0dfaf0a4e1905a9137d3f2f691620529aeb3b4fa
2 files changed
+29
-8
Documentation/git-svn.txt
+16
-8
@@ -49,6 +49,15 @@ COMMANDS
49
(--tags=project/tags') or a full url
50
(--tags=https://foo.org/project/tags)
51
52
+--no-metadata::
53
+ Set the 'noMetadata' option in the [svn-remote] config.
54
+--use-svm-props::
55
+ Set the 'useSvmProps' option in the [svn-remote] config.
56
+--use-svnsync-props::
57
+ Set the 'useSvnsyncProps' option in the [svn-remote] config.
58
+--rewrite-root=<URL>::
59
+ Set the 'rewriteRoot' option in the [svn-remote] config.
60
+
61
--prefix=<prefix>
62
This allows one to specify a prefix which is prepended
63
to the names of remotes if trunk/branches/tags are
@@ -307,8 +316,8 @@ CONFIG FILE-ONLY OPTIONS
316
------------------------
317
--
318
310
-svn.noMetadata:
311
-svn-remote.<name>.noMetadata:
319
+svn.noMetadata::
320
+svn-remote.<name>.noMetadata::
321
This gets rid of the git-svn-id: lines at the end of every commit.
322
323
If you lose your .git/svn/git-svn/.rev_db file, git-svn will not
@@ -319,8 +328,8 @@ svn-remote.<name>.noMetadata:
328
this, either. Using this conflicts with the 'useSvmProps'
329
option for (hopefully) obvious reasons.
330
322
-svn.useSvmProps:
323
-svn-remote.<name>.useSvmProps:
331
+svn.useSvmProps::
332
+svn-remote.<name>.useSvmProps::
333
This allows git-svn to re-map repository URLs and UUIDs from
334
mirrors created using SVN::Mirror (or svk) for metadata.
335
@@ -332,20 +341,19 @@ svn-remote.<name>.useSvmProps:
341
URL and UUID, and use it when generating metadata in commit
342
messages.
343
335
-svn.useSvnsyncProps:
336
-svn-remote.<name>.useSvnsyncprops:
344
+svn.useSvnsyncProps::
345
+svn-remote.<name>.useSvnsyncprops::
346
Similar to the useSvmProps option; this is for users
347
of the svnsync(1) command distributed with SVN 1.4.x and
348
later.
349
341
-svn-remote.<name>.rewriteRoot
350
+svn-remote.<name>.rewriteRoot::
351
This allows users to create repositories from alternate
352
URLs. For example, an administrator could run git-svn on the
353
server locally (accessing via file://) but wish to distribute
354
the repository with a public http:// or svn:// URL in the
355
metadata so users of it will see the public URL.
356
348
-
357
Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
358
options all affect the metadata generated and used by git-svn; they
359
*must* be set in the configuration file before any history is imported
git-svn.perl
+13
@@ -75,9 +75,14 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
75
%remote_opts );
76
77
my ($_trunk, $_tags, $_branches);
78
+my %icv;
79
my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
80
'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
81
'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
82
+ 'no-metadata' => sub { $icv{noMetadata} = 1 },
83
+ 'use-svm-props' => sub { $icv{useSvmProps} = 1 },
84
+ 'use-svnsync-props' => sub { $icv{useSvnsyncProps} = 1 },
85
+ 'rewrite-root=s' => sub { $icv{rewriteRoot} = $_[1] },
86
%remote_opts );
87
my %cmt_opts = ( 'edit|e' => \$_edit,
88
'rmdir' => \$SVN::Git::Editor::_rmdir,
@@ -234,6 +239,14 @@ sub do_git_init_db {
239
}
240
command_noisy(@init_db);
241
}
242
+ my $set;
243
+ my $pfx = "svn-remote.$Git::SVN::default_repo_id";
244
+ foreach my $i (keys %icv) {
245
+ die "'$set' and '$i' cannot both be set\n" if $set;
246
+ next unless defined $icv{$i};
247
+ command_noisy('config', "$pfx.$i", $icv{$i});
248
+ $set = $i;
249
+ }
250
}
251
252
sub init_subdir {