X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=sync-all;h=a7b579ed99254a65479509db0d8d38a63d109a76;hp=360d6fa6526d65cc2b8be2b682635cf6b30126e4;hb=272466d88e4311a1afe066755b88fd5cf782b255;hpb=0885017a4e92fe5710d1427c214adb87b92987e5 diff --git a/sync-all b/sync-all index 360d6fa..a7b579e 100755 --- a/sync-all +++ b/sync-all @@ -68,9 +68,6 @@ my $ignore_failure = 0; my $checked_out_flag = 0; my $get_mode; -# Flags specific to a particular command -my $local_repo_unnecessary = 0; - my %tags; # Figure out where to get the other repositories from. @@ -209,8 +206,6 @@ sub scmall { my $path; my $wd_before = getcwd; - my @scm_args; - my $pwd; my @args; @@ -241,7 +236,7 @@ sub scmall { } else { $branch_name = shift; } - } elsif ($command eq 'new' || $command eq 'fetch') { + } elsif ($command eq 'new') { if (@_ < 1) { $branch_name = 'origin'; } else { @@ -290,27 +285,21 @@ sub scmall { if $localpath ne "."; next; } - - # The first time round the loop, default the get-mode - if ($scm eq "darcs" && not defined($get_mode)) { - warning("adding --partial, to override use --complete"); - $get_mode = "--partial"; - } - - # The only command that doesn't need a repo - $local_repo_unnecessary = 1; - + + # Note that we use "." as the path, as $localpath + # doesn't exist yet. if ($scm eq "darcs") { - # Note: we can only use the get-mode with darcs for now - @scm_args = ("get", $get_mode, $path, $localpath); + # The first time round the loop, default the get-mode + if (not defined($get_mode)) { + warning("adding --partial, to override use --complete"); + $get_mode = "--partial"; + } + scm (".", $scm, "get", $get_mode, $path, $localpath, @args); } else { - @scm_args = ("clone", $path, $localpath); + scm (".", $scm, "clone", $path, $localpath, @args); + scm ($localpath, $scm, "config", "core.ignorecase", "true"); } - - # Note that we use "." as the path, as $localpath - # doesn't exist yet. - scm (".", $scm, @scm_args, @args); next; } @@ -336,34 +325,52 @@ sub scmall { # Work out the arguments we should give to the SCM if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew|status)$/) { - @scm_args = (($scm eq "darcs" and "whatsnew") - or ($scm eq "git" and "status")); - + if ($scm eq "darcs") { + $command = "whatsnew"; + } + elsif ($scm eq "git") { + $command = "status"; + } + else { + die "Unknown scm"; + } + # Hack around 'darcs whatsnew' failing if there are no changes $ignore_failure = 1; + scm ($localpath, $scm, $command, @args); } elsif ($command =~ /^commit$/) { - @scm_args = ("commit"); # git fails if there is nothing to commit, so ignore failures $ignore_failure = 1; + scm ($localpath, $scm, "commit", @args); } elsif ($command =~ /^(?:pus|push)$/) { - @scm_args = "push"; + scm ($localpath, $scm, "push", @args); } elsif ($command =~ /^(?:pul|pull)$/) { - @scm_args = "pull"; + scm ($localpath, $scm, "pull", @args); } elsif ($command =~ /^(?:s|se|sen|send)$/) { - @scm_args = (($scm eq "darcs" and "send") - or ($scm eq "git" and "send-email")); + if ($scm eq "darcs") { + $command = "send"; + } + elsif ($scm eq "git") { + $command = "send-email"; + } + else { + die "Unknown scm"; + } + scm ($localpath, $scm, $command, @args); } elsif ($command =~ /^fetch$/) { - @scm_args = ("fetch", "$branch_name"); + scm ($localpath, $scm, "fetch", @args); } elsif ($command =~ /^new$/) { - @scm_args = ("log", "$branch_name.."); + my @scm_args = ("log", "$branch_name.."); + scm ($localpath, $scm, @scm_args, @args); } elsif ($command =~ /^remote$/) { + my @scm_args; if ($subcommand eq 'add') { @scm_args = ("remote", "add", $branch_name, $path); } elsif ($subcommand eq 'rm') { @@ -371,24 +378,25 @@ sub scmall { } elsif ($subcommand eq 'set-url') { @scm_args = ("remote", "set-url", $branch_name, $path); } + scm ($localpath, $scm, @scm_args, @args); } elsif ($command =~ /^grep$/) { - @scm_args = ("grep"); - # Hack around 'git grep' failing if there are no matches - $ignore_failure = 1; + # Hack around 'git grep' failing if there are no matches + $ignore_failure = 1; + scm ($localpath, $scm, "grep", @args) + unless $scm eq "darcs"; } elsif ($command =~ /^reset$/) { - @scm_args = "reset"; + scm ($localpath, $scm, "reset", @args) + unless $scm eq "darcs"; } elsif ($command =~ /^config$/) { - @scm_args = "config"; + scm ($localpath, $scm, "config", @args) + unless $scm eq "darcs"; } else { die "Unknown command: $command"; } - - # Actually execute the command - scm ($localpath, $scm, @scm_args, @args); } }