X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=sync-all;h=8b41c97711ad3f2ea147af18984e3d65679b0ae2;hp=360d6fa6526d65cc2b8be2b682635cf6b30126e4;hb=cbd7463c986d54422de15cb3b56184de116ef7ba;hpb=0885017a4e92fe5710d1427c214adb87b92987e5 diff --git a/sync-all b/sync-all index 360d6fa..8b41c97 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 { @@ -288,29 +283,26 @@ sub scmall { if (-d $localpath) { warning("$localpath already present; omitting") if $localpath ne "."; + if ($scm eq "git") { + scm ($localpath, $scm, "config", "core.ignorecase", "true"); + } 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; } @@ -318,52 +310,67 @@ sub scmall { if (-d "$localpath/.git") { die "Found both _darcs and .git in $localpath"; } - else { - $scm = "darcs"; - } + $scm = "darcs"; + } elsif (-d "$localpath/.git") { + $scm = "git"; + } elsif ($tag eq "") { + die "Required repo $localpath is missing"; + } else { + message "== $localpath repo not present; skipping"; + next; } - else { - if (-d "$localpath/.git") { - $scm = "git"; + + # Work out the arguments we should give to the SCM + if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew|status)$/) { + if ($scm eq "darcs") { + $command = "whatsnew"; } - elsif ($tag eq "") { - die "Required repo $localpath is missing"; + elsif ($scm eq "git") { + $command = "status"; } else { - message "== $localpath repo not present; skipping"; + die "Unknown scm"; } - } - # 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")); - # 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 =~ /^log$/) { + scm ($localpath, $scm, "log", @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,35 @@ sub scmall { } elsif ($subcommand eq 'set-url') { @scm_args = ("remote", "set-url", $branch_name, $path); } + scm ($localpath, $scm, @scm_args, @args); + } + elsif ($command =~ /^checkout$/) { + # Not all repos are necessarily branched, so ignore failure + $ignore_failure = 1; + scm ($localpath, $scm, "checkout", @args) + unless $scm eq "darcs"; } 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 =~ /^clean$/) { + scm ($localpath, $scm, "clean", @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); } } @@ -414,9 +432,12 @@ Supported commands: * remote add * remote rm * remote set-url [--push] + * checkout * grep + * clean * reset * config + * log Available package-tags are: END