- pull_changes $hostname if $command eq 'diff';
- # commands without path will show host-wide status/changes
- print $client git($command, $rel_path ? $backup_path : $hostname);
+ pull_changes( $hostname ) if $command eq 'diff';
+ if ( $on_host ) {
+ mkpath $_ foreach grep { ! -e $_ } ( "$hostname/$dir", "$on_host/$dir" );
+ rsync( '-avv', "root\@$hostname:$path", "$hostname/$path" );
+ rsync( '-avv', "root\@$on_host:$path", "$on_host/$path" );
+ open(my $diff, '-|', "diff -Nuw $hostname$path $on_host$path");
+ while(<$diff>) {
+ print $client $_;
+ }
+ } else {
+ # commands without path will show host-wide status/changes
+ my $backup_path = $path ? "$hostname/$path" : "$hostname/";
+ # hostname must end with / to prevent error from git:
+ # ambiguous argument 'arh-hw': both revision and filename
+ # to support branches named as hosts
+ print $client git($command, $backup_path);
+ }