diff options
author | Johan Tibell <johan.tibell@gmail.com> | 2012-02-16 19:09:55 -0800 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-02-27 14:35:09 +0000 |
commit | 4bac993e3d00edc0ceac99f4b44ade477ae9aa90 (patch) | |
tree | c6406e745703f1c8bca8c12ac40e4c3fe607ed63 /sync-all | |
parent | ffe282cef4213ab8de515a8574d366994d38d5dd (diff) | |
download | haskell-4bac993e3d00edc0ceac99f4b44ade477ae9aa90.tar.gz |
Add sync-all new-workdir
This command calls git-new-workdir (a separate script in git's contrib
directory) on all repos. Useful to create multiple build trees, without
cloning the repos.
Usage:
sync-all new-workdir <new_workdir> [<branch>]
Diffstat (limited to 'sync-all')
-rwxr-xr-x | sync-all | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -129,6 +129,29 @@ sub warning { } } +sub gitNewWorkdir { + my $dir = shift; + my $target = shift; + my $target_dir = "$target/$dir"; + my $pwd; + + if ($dir eq '.') { + message "== running git-new-workdir . $target_dir @_"; + } else { + message "== $dir: running git-new-workdir . $target_dir @_"; + $pwd = getcwd(); + chdir($dir); + } + + system ("git-new-workdir", ".", $target_dir, @_) == 0 + or $ignore_failure + or die "git-new-workdir failed: $?"; + + if ($dir ne '.') { + chdir($pwd); + } +} + sub scm { my $dir = shift; my $scm = shift; @@ -343,6 +366,9 @@ sub scmall { elsif ($command =~ /^(?:pul|pull)$/) { scm ($localpath, $scm, "pull", @args); } + elsif ($command =~ /^(?:new-workdir)$/) { + gitNewWorkdir ($localpath, @args); + } elsif ($command =~ /^(?:s|se|sen|send)$/) { if ($scm eq "darcs") { $command = "send"; @@ -511,6 +537,7 @@ any extra arguments to git: grep log new + new-workdir pull push repack |