#!ccperl ################################################################################ # # File: bin_merge # Description: This script will perform a merge checking for any merge # conflicts and grouping them at the end. This allows the # majority of a large merge to happen and the user can resolve # the conflicts at a later time. # # This script also assists in performing binary merges for the # common case. With a binary merge one cannot easily merge the # binary code. Most often it's a sitatution where the user will # either accept the source or the destination binary file as # a whole. In cases where there is only a 2 way merge, this # script offers the user the choice to accept 1 binary file # or the other or to abort this binary merge. Binary merges # conflicts greater than 2 way are not handled. # # Author: Andrew@DeFaria.com # Created: Thu Nov 3 10:55:51 PST 2005 # Language: Perl # # (c) Copyright 2005, Andrew@DeFaria.com, all rights reserved # ################################################################################ use strict; use warnings; use Getopt::Long; use File::Spec; my $me; BEGIN { # Set $lib_path my $lib_path = $^O =~ /MSWin/ ? "\\\\brcm-irv\\dfs\\projects\\ccase\\SCM\\lib" : "/projects/ccase/SCM/lib"; # Extract relative path and basename from script name. $0 =~ /(.*)[\/\\](.*)/; my $abs_path = (!defined $1) ? "." : File::Spec->rel2abs ($1); $me = (!defined $2) ? $0 : $2; $me =~ s/\.pl$//; # Remove .pl for Perl scripts that have that extension $me =~ s/\.pl$//; # Add the appropriate path to our modules to @INC array. unshift @INC, "$abs_path"; unshift @INC, $ENV {SITE_PERL_LIBPATH} if defined $ENV {SITE_PERL_LIBPATH}; unshift @INC, "$lib_path"; } # BEGIN use BinMerge; use Display; use Logger; sub Usage { my $msg = shift; display "ERROR: $msg\n" if defined $msg; display "Usage: $me [-u] [-v] [-d] -branch -path Where: -u: Display usage -v: Turn on verbose mode -d: Turn on debug mode -branch Branch to merge from -path: Path to consider (Default .) "; exit 1; } # Usage my $branch; my $path = "."; my $verbose = 0; my $debug = 0; while ($ARGV [0]) { if ($ARGV [0] eq "-v") { $verbose = 1; } elsif ($ARGV [0] eq "-d") { $debug = 1; } elsif ($ARGV [0] eq "-branch") { shift; if (!$ARGV [0]) { Usage "Must specify after -branch"; } else { $branch = $ARGV [0]; } # if } elsif ($ARGV [0] eq "-path") { shift; if (!$ARGV [0]) { Usage "Must specify after -path"; } else { $path = join (" ", @ARGV); } # if } elsif ($ARGV [0] eq "-u") { Usage; } else { Usage "Unknown argument found: " . $ARGV [0]; } # if shift (@ARGV); } # while Usage "Must specify a branch" if !defined $branch; Merge $branch, $path, $verbose, $debug;