Browse Source

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>
maint
Eric Wong 18 years ago
parent
commit
0dfaf0a4e1
  1. 24
      Documentation/git-svn.txt
  2. 13
      git-svn.perl

24
Documentation/git-svn.txt

@ -49,6 +49,15 @@ COMMANDS
(--tags=project/tags') or a full url (--tags=project/tags') or a full url
(--tags=https://foo.org/project/tags) (--tags=https://foo.org/project/tags)


--no-metadata::
Set the 'noMetadata' option in the [svn-remote] config.
--use-svm-props::
Set the 'useSvmProps' option in the [svn-remote] config.
--use-svnsync-props::
Set the 'useSvnsyncProps' option in the [svn-remote] config.
--rewrite-root=<URL>::
Set the 'rewriteRoot' option in the [svn-remote] config.

--prefix=<prefix> --prefix=<prefix>
This allows one to specify a prefix which is prepended This allows one to specify a prefix which is prepended
to the names of remotes if trunk/branches/tags are to the names of remotes if trunk/branches/tags are
@ -307,8 +316,8 @@ CONFIG FILE-ONLY OPTIONS
------------------------ ------------------------
-- --


svn.noMetadata: svn.noMetadata::
svn-remote.<name>.noMetadata: svn-remote.<name>.noMetadata::
This gets rid of the git-svn-id: lines at the end of every commit. This gets rid of the git-svn-id: lines at the end of every commit.


If you lose your .git/svn/git-svn/.rev_db file, git-svn will not If you lose your .git/svn/git-svn/.rev_db file, git-svn will not
@ -319,8 +328,8 @@ svn-remote.<name>.noMetadata:
this, either. Using this conflicts with the 'useSvmProps' this, either. Using this conflicts with the 'useSvmProps'
option for (hopefully) obvious reasons. option for (hopefully) obvious reasons.


svn.useSvmProps: svn.useSvmProps::
svn-remote.<name>.useSvmProps: svn-remote.<name>.useSvmProps::
This allows git-svn to re-map repository URLs and UUIDs from This allows git-svn to re-map repository URLs and UUIDs from
mirrors created using SVN::Mirror (or svk) for metadata. mirrors created using SVN::Mirror (or svk) for metadata.


@ -332,20 +341,19 @@ svn-remote.<name>.useSvmProps:
URL and UUID, and use it when generating metadata in commit URL and UUID, and use it when generating metadata in commit
messages. messages.


svn.useSvnsyncProps: svn.useSvnsyncProps::
svn-remote.<name>.useSvnsyncprops: svn-remote.<name>.useSvnsyncprops::
Similar to the useSvmProps option; this is for users Similar to the useSvmProps option; this is for users
of the svnsync(1) command distributed with SVN 1.4.x and of the svnsync(1) command distributed with SVN 1.4.x and
later. later.


svn-remote.<name>.rewriteRoot svn-remote.<name>.rewriteRoot::
This allows users to create repositories from alternate This allows users to create repositories from alternate
URLs. For example, an administrator could run git-svn on the URLs. For example, an administrator could run git-svn on the
server locally (accessing via file://) but wish to distribute server locally (accessing via file://) but wish to distribute
the repository with a public http:// or svn:// URL in the the repository with a public http:// or svn:// URL in the
metadata so users of it will see the public URL. metadata so users of it will see the public URL.



Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
options all affect the metadata generated and used by git-svn; they options all affect the metadata generated and used by git-svn; they
*must* be set in the configuration file before any history is imported *must* be set in the configuration file before any history is imported

13
git-svn.perl

@ -75,9 +75,14 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
%remote_opts ); %remote_opts );


my ($_trunk, $_tags, $_branches); my ($_trunk, $_tags, $_branches);
my %icv;
my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared, my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags, 'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix, 'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
'no-metadata' => sub { $icv{noMetadata} = 1 },
'use-svm-props' => sub { $icv{useSvmProps} = 1 },
'use-svnsync-props' => sub { $icv{useSvnsyncProps} = 1 },
'rewrite-root=s' => sub { $icv{rewriteRoot} = $_[1] },
%remote_opts ); %remote_opts );
my %cmt_opts = ( 'edit|e' => \$_edit, my %cmt_opts = ( 'edit|e' => \$_edit,
'rmdir' => \$SVN::Git::Editor::_rmdir, 'rmdir' => \$SVN::Git::Editor::_rmdir,
@ -234,6 +239,14 @@ sub do_git_init_db {
} }
command_noisy(@init_db); command_noisy(@init_db);
} }
my $set;
my $pfx = "svn-remote.$Git::SVN::default_repo_id";
foreach my $i (keys %icv) {
die "'$set' and '$i' cannot both be set\n" if $set;
next unless defined $icv{$i};
command_noisy('config', "$pfx.$i", $icv{$i});
$set = $i;
}
} }


sub init_subdir { sub init_subdir {

Loading…
Cancel
Save