Code

gitweb: Lift any characters restriction on searched strings
[git.git] / git-svn.perl
index ee7ef693fa9300082ca090ebf97f7e242043fb72..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(@_);
        }
@@ -370,6 +377,7 @@ sub cmd_dcommit {
        $head ||= 'HEAD';
        my @refs;
        my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
+       print "Committing to $url ...\n";
        unless ($gs) {
                die "Unable to determine upstream SVN information from ",
                    "$head history\n";
@@ -3501,11 +3509,17 @@ sub log_use_color {
 sub git_svn_log_cmd {
        my ($r_min, $r_max, @args) = @_;
        my $head = 'HEAD';
+       my (@files, @log_opts);
        foreach my $x (@args) {
-               last if $x eq '--';
-               next unless ::verify_ref("$x^0");
-               $head = $x;
-               last;
+               if ($x eq '--' || @files) {
+                       push @files, $x;
+               } else {
+                       if (::verify_ref("$x^0")) {
+                               $head = $x;
+                       } else {
+                               push @log_opts, $x;
+                       }
+               }
        }
 
        my ($url, $rev, $uuid, $gs) = ::working_head_info($head);
@@ -3515,13 +3529,13 @@ sub git_svn_log_cmd {
        push @cmd, '-r' unless $non_recursive;
        push @cmd, qw/--raw --name-status/ if $verbose;
        push @cmd, '--color' if log_use_color();
-       return @cmd unless defined $r_max;
-       if ($r_max == $r_min) {
+       push @cmd, @log_opts;
+       if (defined $r_max && $r_max == $r_min) {
                push @cmd, '--max-count=1';
                if (my $c = $gs->rev_db_get($r_max)) {
                        push @cmd, $c;
                }
-       } else {
+       } elsif (defined $r_max) {
                my ($c_min, $c_max);
                $c_max = $gs->rev_db_get($r_max);
                $c_min = $gs->rev_db_get($r_min);
@@ -3537,7 +3551,7 @@ sub git_svn_log_cmd {
                        push @cmd, $c_min;
                }
        }
-       return @cmd;
+       return (@cmd, @files);
 }
 
 # adapted from pager.c
@@ -3702,7 +3716,7 @@ sub cmd_show_log {
        }
 
        config_pager();
-       @args = (git_svn_log_cmd($r_min, $r_max, @args), @args);
+       @args = git_svn_log_cmd($r_min, $r_max, @args);
        my $log = command_output_pipe(@args);
        run_pager();
        my (@k, $c, $d, $stat);