]> Pileus Git - ~andy/git/commitdiff
git-svn init/clone --stdlayout option to default-init trunk/tags/branches
authormartin f. krafft <madduck@madduck.net>
Sat, 14 Jul 2007 09:25:28 +0000 (11:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Aug 2007 07:18:02 +0000 (00:18 -0700)
The --stdlayout option to git-svn init/clone initialises the default
Subversion values of trunk,tags,branches: -T trunk -b branches -t tags.
If any of the -T/-t/-b options are given in addition, they are given
preference.

[ew: fixed whitespace and added "-s" shortcut]

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Documentation/git-svn.txt
git-svn.perl

index fbc58871f5df1207c6e32baf992992d8b39e03ae..3e2a63b7460f4051fae52b7c1b2ceb4ea6dd1163 100644 (file)
@@ -44,10 +44,15 @@ COMMANDS
 --tags=<tags_subdir>;;
 -b<branches_subdir>;;
 --branches=<branches_subdir>;;
+-s;;
+--stdlayout;;
        These are optional command-line options for init.  Each of
        these flags can point to a relative repository path
        (--tags=project/tags') or a full url
-       (--tags=https://foo.org/project/tags)
+       (--tags=https://foo.org/project/tags). The option --stdlayout is
+       a shorthand way of setting trunk,tags,branches as the relative paths,
+       which is the Subversion default. If any of the other options are given
+       as well, they take precedence.
 --no-metadata;;
        Set the 'noMetadata' option in the [svn-remote] config.
 --use-svm-props;;
index 7a8ffd522799e79aded50d796c7f313fc6a200c6..4e325b771ba136e40b9a420e16f043fbaf5d7bb7 100755 (executable)
@@ -77,11 +77,12 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
                   \$Git::SVN::_repack_flags,
                %remote_opts );
 
-my ($_trunk, $_tags, $_branches);
+my ($_trunk, $_tags, $_branches, $_stdlayout);
 my %icv;
 my %init_opts = ( 'template=s' => \$_template, 'shared:s' => \$_shared,
                   'trunk|T=s' => \$_trunk, 'tags|t=s' => \$_tags,
                   'branches|b=s' => \$_branches, 'prefix=s' => \$_prefix,
+                  'stdlayout|s' => \$_stdlayout,
                   'minimize-url|m' => \$Git::SVN::_minimize_url,
                  'no-metadata' => sub { $icv{noMetadata} = 1 },
                  'use-svm-props' => sub { $icv{useSvmProps} = 1 },
@@ -292,7 +293,8 @@ sub init_subdir {
 sub cmd_clone {
        my ($url, $path) = @_;
        if (!defined $path &&
-           (defined $_trunk || defined $_branches || defined $_tags) &&
+           (defined $_trunk || defined $_branches || defined $_tags ||
+            defined $_stdlayout) &&
            $url !~ m#^[a-z\+]+://#) {
                $path = $url;
        }
@@ -302,6 +304,11 @@ sub cmd_clone {
 }
 
 sub cmd_init {
+       if (defined $_stdlayout) {
+               $_trunk = 'trunk' if (!defined $_trunk);
+               $_tags = 'tags' if (!defined $_tags);
+               $_branches = 'branches' if (!defined $_branches);
+       }
        if (defined $_trunk || defined $_branches || defined $_tags) {
                return cmd_multi_init(@_);
        }