ClearCase-SyncTree

 view release on metacpan or  search on metacpan

synctree  view on Meta::CPAN

## But as of CC 4.1 there's a new "xml" eltype that fixes it.
### And as of CC 6.0 xml files are considered binary!?
## $sync->eltypemap('\.xml$' => 'compressed_file');

# If nothing was done, exeunt stage left.
exit $rc unless $sync->get_addhash || $sync->get_modhash
		                   || $sync->get_sublist || $sync->_lsco;

# Prompt the user before checkin if -ci not in use.
if (! $opt{ci}) {
    my $b = MSWIN ? 'Cancel' : 'Abort';
    my $msg = "Check in all changes? (No to leave checked out, $b to unco all)";
    $msg = qq("$msg") if MSWIN;
    my $resp = system(qw(clearprompt yes_no -pro), $msg) >> 8;
    $sync->fail if $resp > 1;
    $opt{ci} = !$resp;
}

# Get rid of the exception handler before starting the checkin
# process, as once a checkin succeeds there's no going back.
# Instead, count subsequent errors in a scalar.
$sync->err_handler(\$rc);
# Now check in the changes
$sync->checkin if $opt{ci} || $opt{cr};

exit $rc;

__END__

=head1 NAME

synctree - Normalize a tree of flat files with a tree of ClearCase elements

=head1 SYNOPSIS

  synctree -sbase /tmp/newcode -dbase /vobs_tps/xxx

Take all files located under /tmp/newcode, remove the leading
"/tmp/newcode" from each of their pathnames, and place the remaining
relative paths under "/vobs_tps/xxx" as versioned elements, leaving
them checked out.

  synctree -cr -yes -ci -sbase /vobs/hpux/bin -dbase /vobs_rel/hpux/bin

Sync all files under "/vobs_rel/hpux/bin" with those in
"/vobs/hpux/bin", making sure to preserve their CR's. Suppress
interactive prompting and check in all work when done.

  synctree -sb /A/B -db /X/Y -map /A/B/foo /X/Y/bar /A/B/here /X/Y/there

Take 'foo' from directory /A/B and check it in as 'bar' in /X/Y.
Similarly, create an element /X/Y/there with the contents of /A/B/here.

=head1 DESCRIPTION

Synctree brings a VOB area into alignment with a specified set of files
from a source area. It's analogous in various ways to I<clearfsimport>,
I<citree>, and I<clearexport/clearimport>; see the COMPARISONS section
below.  Synctree is useful if you have a ClearCase tree that must be
kept in sync with a CVS tree during a transition period, or for
overlaying releases of third-party products upon previous ones, or
exporting deliverable DO's from a nightly build to a release VOB while
preserving config records (CR's) and labels, or similar.

The default operation is to mkelem all files which exist in
I<E<lt>srcE<gt>> but not in I<E<lt>destE<gt>>, modify any files which
exist in both but differ, but B<not> to remove files which are present
in I<E<lt>destE<gt>> and not in I<E<lt>srcE<gt>>.  Adding the
I<-rmname> flag will cause this removal to happen as well and thus make
the I<E<lt>srcE<gt>> and I<E<lt>destE<gt>> areas identical.

Synctree need not run in a view context itself but the directory named
by the I<-dbase> flag must provide a view context. The branching
behavior of any checkouts performed will be governed by that view's
config spec.  The I<-dbase> directory need not exist, as long as it
lies under a mounted VOB tag and in a view context. In other words,
synctree can auto-create the destination directory tree.

The list of source files to operate on may be provided with the
I<-flist> option or it may come from C<@ARGV>. Any directories
encountered on the command line will be traversed recursively. If no
source-file-list is provided, the directory specified with I<-sbase> is
used as the default.

File paths may be given as relative or absolute. Destination paths are
determined as follows: all source filenames are first turned into
absolute paths if necessary, then the source preface given with the
I<-sbase> parameter is removed and replaced with the value of I<-dbase>
to produce the destination pathname (but see FILE MAPPING below).

ClearCase symbolic links are supported, even on Windows.  Note that,
unless you use the I<-rellinks> flag, the text of the link is
transported B<verbatim> from source area to dest area; thus relative
symlinks may no longer resolve in the destination area.

Consider using the I<-n> flag the first time you use this on a valued
VOB, even though nothing irreversible (I<rmelem>, I<rmbranch>,
I<rmver>, I<rmtype>, etc.) is B<ever> done by synctree.  And by the
same token use I<-yes> and I<-ci> with care.

=head1 OPTIONS

Not all options are described here, only those requiring elaboration
beyond the C<-help> summary. Run C<synctree -help> for a full option
summary.

=over

=item * I<-force, -stop>

By default, upon encountering a ClearCase error synctree will attempt
to return to the initial state by undoing all checkouts etc. The
I<-stop> flag will cause it to exit immediately leaving the partial
state intact while I<-force> will cause it to blunder onward, ignoring
errors. However, even with I<-force> a nonzero status is returned if
errors are encountered.

=item * I<-ignore_co, -overwrite_co>

By default, synctree refuses to run if any view-private files exist
under the destination base. This includes checkouts, which are a



( run in 0.844 second using v1.01-cache-2.11-cpan-437f7b0c052 )