#!/usr/bin/perl -w use 5.004; # just in case use Getopt::Long; use strict; use integer; my $debug_level=1; sub debug($$) { my ($lvl, $msg)=@_; print STDERR $msg, "\n" if $lvl <= $debug_level; } =head1 NAME B - synchronize PRCS projects between repositories =head1 SYNOPSIS Synchronize between old and new repositories, both on local disk: synch --proj=myproject --remote-repo=/somewhere/old \ --local-repo=/somewhere/new Synchronize over ssh: synch --proj=myproj --ssh=alterego@nowhere.net =head1 OPTIONS Standard GNU-style options are used. =over 4 =item B<--proj=>I (mandatory) PRCS project name. =item B<--tmpdir=>I (optional) Scratch area, should have ample space relative to project. Defaults to F. =item B<--debug=>I (optional) Debug level, higher means more. Default 1. =item B<--local-repo=>I (optional) Local repository: this is where updates will be placed. If not specified, the envvar B is tried, then the PRCS internal configuration. =item B<--remote-repo=>I (sometimes optional) "Remote" repository, i.e. where the original versions are to be synched from. This is mandatory unless B<--ssh> is specified, in which case the same heuristics are tried as for the local repository. (If you are accustomed to B<$PRCS_REPOSITORY> being set for your personal environment, try F<~/.ssh/environment> on the remote host.) =item B<--dir=>{ B | B | B } (optional) Controls direction of synchronization. By default, B is assumed: you want to synchronize changes in both directions. B means send changes to remote from local only; B means get changes from remote only. =item B<--ssh=> [ IB<@> ] I (optional) Access the remote repository using ssh (Secure SHell). This must be installed as F (and of course the remote host must be running the server). Give it a hostname or user@host syntax. You may do synchronization in any direction, but if going upstream, you need to have this script installed and in your default path on the remote machine as well. ssh may prompt you for passwords or passphrases multiple times; to avoid this annoyance, you should set up ssh properly so you have an authenticated identity, and use F to make the authentication transparent. If in doubt as to whether this is working, you should be able to do this and have it not prompt at all: ssh -l user host echo looks good For a quick test, this will probably work: ssh-agent sh -c 'ssh-add; synch ....' =item B<--ssh-opts>=I