#!ccperl ################################################################################ # # File: bin_rebase # Description: This script will perform a rebase 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, $SEPARATOR, $NULL); BEGIN { my ($abs_path, $lib_path); # Extract relative path and basename from script name. $0 =~ /(.*)[\/\\](.*)/; $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$//; # Define the path SEPARATOR $SEPARATOR = ($^O =~ /MSWin/) ? "\\" : "/"; $NULL = ($^O =~ /MSWin/) ? "NUL" : "/dev/null"; # Setup paths $lib_path = "$abs_path" . $SEPARATOR . ".." . $SEPARATOR . "lib"; # Add the appropriate path to our modules to @INC array. unshift (@INC, "$abs_path"); 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] -view { -recommended | -baseline } Where: -u: Display usage -v: Turn on verbose mode -d: Turn on debug mode -recommended: Rebase from recommended baselines -baseline: Rebase from this baseline "; exit 1; } # Usage my $baseline; 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 "-recommended") { # Nothing to do, leave $baseline undefined } elsif ($ARGV [0] eq "-baseline") { shift; if (!$ARGV [0]) { Usage "Must specify after -baseline"; } else { $baseline = $ARGV [0]; } # if } elsif ($ARGV [0] eq "-u") { Usage; } else { Usage "Unknown argument found: " . $ARGV [0]; } # if shift (@ARGV); } # while Rebase $baseline, $verbose, $debug;