Ticket #5880: 0001-Add-sync-all-new-workdir.patch

File 0001-Add-sync-all-new-workdir.patch, 1.7 KB (added by tibbe, 4 years ago)
  • sync-all

    From 3264e71bd048ce4ca015ca8cca3cfaf8c064dc7a Mon Sep 17 00:00:00 2001
    From: Johan Tibell <[email protected]>
    Date: Thu, 16 Feb 2012 19:09:55 -0800
    Subject: [PATCH 1/1] 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>]
    ---
     sync-all |   27 +++++++++++++++++++++++++++
     1 files changed, 27 insertions(+), 0 deletions(-)
    
    diff --git a/sync-all b/sync-all
    index 0039219..87186de 100755
    a b sub warning { 
    129129    }
    130130}
    131131
     132sub gitNewWorkdir {
     133    my $dir = shift;
     134    my $target = shift;
     135    my $target_dir = "$target/$dir";
     136    my $pwd;
     137
     138    if ($dir eq '.') {
     139        message "== running git-new-workdir . $target_dir @_";
     140    } else {
     141        message "== $dir: running git-new-workdir . $target_dir @_";
     142        $pwd = getcwd();
     143        chdir($dir);
     144    }
     145
     146    system ("git-new-workdir", ".", $target_dir, @_) == 0
     147        or $ignore_failure
     148        or die "git-new-workdir failed: $?";
     149
     150    if ($dir ne '.') {
     151        chdir($pwd);
     152    }
     153}
     154
    132155sub scm {
    133156    my $dir = shift;
    134157    my $scm = shift;
    sub scmall { 
    343366        elsif ($command =~ /^(?:pul|pull)$/) {
    344367            scm ($localpath, $scm, "pull", @args);
    345368        }
     369        elsif ($command =~ /^(?:new-workdir)$/) {
     370            gitNewWorkdir ($localpath, @args);
     371        }
    346372        elsif ($command =~ /^(?:s|se|sen|send)$/) {
    347373            if ($scm eq "darcs") {
    348374                $command = "send";
    any extra arguments to git: 
    511537  grep
    512538  log
    513539  new
     540  new-workdir
    514541  pull
    515542  push
    516543  repack