[Bps-public-commit] git-sync branch, master, updated. 441fdb92f8fc33cb8f7f2687585e6afe41937243

Alex Vandiver alexmv at bestpractical.com
Wed Sep 15 10:56:38 EDT 2010


The branch, master has been updated
       via  441fdb92f8fc33cb8f7f2687585e6afe41937243 (commit)
       via  7da25b4c2846a861aefa9d78b2a287ecaa53a9ba (commit)
      from  2f75f3088bf69d30ee6f3f80ba8069b7be63b3a1 (commit)

Summary of changes:
 git-sync |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 7da25b4c2846a861aefa9d78b2a287ecaa53a9ba
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 15 10:58:40 2010 -0400

    Allow "local" configs to explicitly start SSH master connections

diff --git a/git-sync b/git-sync
index e6c812a..a1d1e59 100755
--- a/git-sync
+++ b/git-sync
@@ -127,6 +127,10 @@ Remote and Github configurations also support the C<email> key; if set,
 newly-cloned repositories will have C<user.email> set to the given
 value.
 
+Remote configurations automatically attempt to set up an SSH master
+connection.  C<local> configurations can start one or more SSH master
+connections by explicitly providing C<sshmaster> configuration lines.
+
 =head1 OPTIONS
 
 =over
@@ -275,6 +279,8 @@ stop_masters();
 
 sub sync_all_local {
     my %config = @_;
+    my @sshmaster = ref $config{sshmaster} ? @{$config{sshmaster}} : $config{sshmaster};
+    start_master($_) for @sshmaster;
     foreach my $into ( ref $config{into} ? @{$config{into}} : $config{into} ) {
         unless (-d $into) {
             print colored("  Directory '$into' does not exist!\n", "bold red");
@@ -425,10 +431,10 @@ sub sync_all_remote {
 
 sub start_master {
     my ($host) = @_;
-    printf colored("  %-40s ", "dark"), "Starting ssh master connection";
+    printf colored("  %-40s ", "dark"), $host;
     my $status = `ssh -O check $host 2>&1`;
     if ( $status =~ /^Master running \(pid=(\d+)\)/) {
-        print colored( "[ Already running (PID $1) ]\n", "dark");
+        print colored( "[ Already running SSH master (PID $1) ]\n", "dark");
         return;
     } elsif ( $status =~ /^No ControlPath/) {
         print colored( "[ Not configured -- see ControlPath in ssh_config(5) ]\n", "yellow" );
@@ -455,7 +461,7 @@ sub start_master {
     }
 
     sleep 1 while (`ssh -O check $host 2>&1` !~ /Master running \(pid=(\d+)\)/);
-    print colored( "[ Started (PID $1) ]\n", "green" );
+    print colored( "[ SSH master started (PID $1) ]\n", "green" );
     $masters{$host} = $pid;
 }
 

commit 441fdb92f8fc33cb8f7f2687585e6afe41937243
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Sep 15 10:59:31 2010 -0400

    We use C<local> to sort by, but it is otherwise intuitable

diff --git a/git-sync b/git-sync
index a1d1e59..99ab611 100755
--- a/git-sync
+++ b/git-sync
@@ -253,6 +253,7 @@ if (@ARGV) {
         push @categories, $name;
     }
 } else {
+    $_->{local} = 1 for grep {not $_->{host} and not $_->{github}} values %sync;
     @categories = sort {exists $sync{$a}{local} <=> exists $sync{$b}{local} or $a cmp $b} keys %sync;
     die qq{No sync targets configured!  Edit your ~/.gitconfig to add one.\n}
         unless @categories;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list