@matheusbsbs / matheus-bagliano / commits / ecc712ddc4
Fork 0

git-svn: re-enable repacking flags

Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Jan 31, 2007 at 12:28 UTC ecc712ddc41999e5f082cb69406d30caa062c6b9
1 file changed +22 -4
git-svn.perl
+22 -4
@@ -52,7 +52,6 @@ my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS};
52 $sha1 = qr/[a-f\d]{40}/;
53 $sha1_short = qr/[a-f\d]{4,40}/;
54 my ($_stdin, $_help, $_edit,
55 - $_repack, $_repack_nr, $_repack_flags,
55 $_message, $_file,
56 $_template, $_shared,
57 $_version,
@@ -64,10 +63,11 @@ my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
63 'no-auth-cache' => \$Git::SVN::Prompt::_no_auth_cache );
64 my %fc_opts = ( 'follow-parent|follow' => \$Git::SVN::_follow_parent,
65 'authors-file|A=s' => \$_authors,
67 - 'repack:i' => \$_repack,
66 + 'repack:i' => \$Git::SVN::_repack,
67 'no-metadata' => \$Git::SVN::_no_metadata,
68 'quiet|q' => \$_q,
70 - 'repack-flags|repack-args|repack-opts=s' => \$_repack_flags,
69 + 'repack-flags|repack-args|repack-opts=s' =>
70 + \$Git::SVN::_repack_flags,
71 %remote_opts );
72
73 my ($_trunk, $_tags, $_branches);
@@ -158,6 +158,7 @@ load_authors() if $_authors;
158 unless ($cmd =~ /^(?:init|multi-init|commit-diff)$/) {
159 Git::SVN::Migration::migration_check();
160 }
161 +Git::SVN::init_vars();
162 eval {
163 Git::SVN::verify_remotes_sanity();
164 $cmd{$cmd}->[0]->(@ARGV);
@@ -626,11 +627,13 @@ sub cmt_metadata {
627 package Git::SVN;
628 use strict;
629 use warnings;
629 -use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent/;
630 +use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
631 + $_repack $_repack_flags/;
632 use Carp qw/croak/;
633 use File::Path qw/mkpath/;
634 use IPC::Open3;
635
636 +my $_repack_nr;
637 # properties that we do not log:
638 my %SKIP_PROP;
639 BEGIN {
@@ -676,6 +679,14 @@ sub read_all_remotes {
679 $r;
680 }
681
682 +sub init_vars {
683 + if (defined $_repack) {
684 + $_repack = 1000 if ($_repack <= 0);
685 + $_repack_nr = $_repack;
686 + $_repack_flags ||= '-d';
687 + }
688 +}
689 +
690 sub verify_remotes_sanity {
691 return unless -d $ENV{GIT_DIR};
692 my %seen;
@@ -1025,6 +1036,13 @@ sub do_git_commit {
1036 $self->{last_rev} = $log_entry->{revision};
1037 $self->{last_commit} = $commit;
1038 print "r$log_entry->{revision} = $commit ($self->{ref_id})\n";
1039 + if (defined $_repack && (--$_repack_nr == 0)) {
1040 + $_repack_nr = $_repack;
1041 + # repack doesn't use any arguments with spaces in them, does it?
1042 + print "Running git repack $_repack_flags ...\n";
1043 + command_noisy('repack', split(/\s+/, $_repack_flags));
1044 + print "Done repacking\n";
1045 + }
1046 return $commit;
1047 }
1048