+ }
+
+ # 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;
+ }
+ elsif ($command =~ /^commit$/) {
+ @scm_args = ("commit");
+ # git fails if there is nothing to commit, so ignore failures
+ $ignore_failure = 1;
+ }
+ elsif ($command =~ /^(?:pus|push)$/) {
+ @scm_args = "push";
+ }
+ elsif ($command =~ /^(?:pul|pull)$/) {
+ @scm_args = "pull";
+ }
+ elsif ($command =~ /^(?:s|se|sen|send)$/) {
+ @scm_args = (($scm eq "darcs" and "send")
+ or ($scm eq "git" and "send-email"));
+ }
+ elsif ($command =~ /^fetch$/) {
+ @scm_args = ("fetch", "$branch_name");
+ }
+ elsif ($command =~ /^new$/) {
+ @scm_args = ("log", "$branch_name..");
+ }
+ elsif ($command =~ /^remote$/) {
+ if ($subcommand eq 'add') {
+ @scm_args = ("remote", "add", $branch_name, $path);
+ } elsif ($subcommand eq 'rm') {
+ @scm_args = ("remote", "rm", $branch_name);
+ } elsif ($subcommand eq 'set-url') {
+ @scm_args = ("remote", "set-url", $branch_name, $path);
+ }
+ }
+ elsif ($command =~ /^grep$/) {
+ @scm_args = ("grep");
+ # Hack around 'git grep' failing if there are no matches
+ $ignore_failure = 1;
+ }
+ elsif ($command =~ /^reset$/) {
+ @scm_args = "reset";
+ }
+ elsif ($command =~ /^config$/) {
+ @scm_args = "config";
+ }
+ else {
+ die "Unknown command: $command";
+ }
+
+ # Actually execute the command
+ scm ($localpath, $scm, @scm_args, @args);