Subversion Repositories DevTools

Rev

Rev 2651 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2651 Rev 2930
Line 37... Line 37...
37
my $opt_manual = 0;
37
my $opt_manual = 0;
38
my $opt_new_label;
38
my $opt_new_label;
39
my $opt_old_label;
39
my $opt_old_label;
40
my $opt_md5check;
40
my $opt_md5check;
41
my $opt_mode;
41
my $opt_mode;
-
 
42
my $opt_diff;
42
 
43
 
43
#
44
#
44
#   Globals - Provided by the JATS environment
45
#   Globals - Provided by the JATS environment
45
#
46
#
46
my $USER            = $ENV{'USER'};
47
my $USER            = $ENV{'USER'};
Line 49... Line 50...
49
my $MACHINENAME     = $ENV{'GBE_HOSTNAME'};
50
my $MACHINENAME     = $ENV{'GBE_HOSTNAME'};
50
 
51
 
51
#
52
#
52
#   Globals
53
#   Globals
53
#
54
#
-
 
55
my $Name            = 'BeyondCompare';
54
my $BC2             = 'c:/Program Files/Beyond Compare 2/BC2.exe';
56
my $DiffProg        = 'c:/Program Files/Beyond Compare 2/BC2.exe';
-
 
57
my @DiffArgs;
-
 
58
my $DiffWait;
55
my @view_tags;
59
my @view_tags;
56
my @view_commands;
60
my @view_commands;
57
my @cleanFiles;
61
my @cleanFiles;
58
 
62
 
59
 
63
 
Line 74... Line 78...
74
                "verbose:+"     => \$opt_verbose,           # Verbosity
78
                "verbose:+"     => \$opt_verbose,           # Verbosity
75
                "debug:+"       => \$opt_debug,             # Debug Verbosity
79
                "debug:+"       => \$opt_debug,             # Debug Verbosity
76
                "new=s"         => \$opt_new_label,         # Path1
80
                "new=s"         => \$opt_new_label,         # Path1
77
                "old=s"         => \$opt_old_label,         # Path2
81
                "old=s"         => \$opt_old_label,         # Path2
78
                'check'         => \$opt_md5check,          # Force MD5 Check
82
                'check'         => \$opt_md5check,          # Force MD5 Check
-
 
83
                'diff!'         => \$opt_diff,              # Force use of diff
79
                );
84
                );
80
 
85
 
81
                #
86
                #
82
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
87
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
83
                #
88
                #
Line 96... Line 101...
96
#
101
#
97
ErrorConfig( 'name'    => 'VCSDIFF',
102
ErrorConfig( 'name'    => 'VCSDIFF',
98
             'verbose' => $opt_verbose,
103
             'verbose' => $opt_verbose,
99
             'debug'   => $opt_debug );
104
             'debug'   => $opt_debug );
100
 
105
 
-
 
106
Error ("Options -check and -diff cannot be combined")
-
 
107
    if ( $opt_md5check && $opt_diff );
-
 
108
 
101
#
109
#
102
#   Determine mode
110
#   Determine mode
103
#   Not all modes work on all machines
111
#   Not all modes work on all machines
104
#
112
#
105
Verbose ("Machine Type: UNIX=$UNIX");
113
Verbose ("Machine Type: UNIX=$UNIX");
106
if ( $opt_md5check )
114
if ( $opt_md5check )
107
{
115
{
108
    $opt_mode = 'md5';
116
    $opt_mode = 'md5';
109
}
117
}
-
 
118
elsif ( $UNIX || $opt_diff )
-
 
119
{
-
 
120
    $opt_mode = 'diff';
-
 
121
    $Name = 'diff';
-
 
122
    push @DiffArgs, '-r';
-
 
123
    $Name = 'gdiff';
-
 
124
    $DiffProg = LocateProgInPath( $Name, '--All');
-
 
125
    unless ( $DiffProg =~ m~/~ )
-
 
126
    {
-
 
127
        $Name = 'diff';
-
 
128
        $DiffProg = LocateProgInPath( $Name, '--All');
-
 
129
    }
-
 
130
 
-
 
131
    Error ("Cannot locate a 'diff' utility in the users PATH")
-
 
132
        unless ( $DiffProg =~ m~/~ );
-
 
133
}
110
else
134
else
111
{
135
{
112
    $opt_mode = 'bc2';
136
    $opt_mode = 'bc2';
113
    Error ("Use of BeyondCompare is limited to Windows", "Only the -check mode is available under Unix")
-
 
114
        if ( $UNIX );
137
    $DiffWait = 1;
115
 
138
 
116
    #
139
    #
117
    #   Determine the path to BC2.EXE
140
    #   Determine the path to BC2.EXE
118
    #   It maynot be installed in the default place
141
    #   It may not be installed in the default place
119
    #
142
    #
120
    if ( ! -x $BC2 )
143
    if ( ! -x $DiffProg )
121
    {
144
    {
122
        $BC2 = GetBc2ExePath();
145
        $DiffProg = GetBc2ExePath();
123
    }
146
    }
124
}
147
}
125
 
148
 
126
#
149
#
127
#   Validate user options
150
#   Validate user options
Line 197... Line 220...
197
                '-rootdir', $path2 ) unless $rv;
220
                '-rootdir', $path2 ) unless $rv;
198
 
221
 
199
    exit $rv;
222
    exit $rv;
200
}
223
}
201
 
224
 
-
 
225
#
-
 
226
#   Diffing the paths
-
 
227
#   Will use BeyondCompare under Windows
-
 
228
#   Will use diff under unix
-
 
229
#
-
 
230
Message ("Using '$Name' to compare two views",
-
 
231
         "Wait for utility to exit so that we can delete the views" ) if ($DiffWait);
202
 
232
 
203
Message ("Using Beyond Compare to compare two views",
233
Verbose ("Diff Utility: $DiffProg");
204
         "Wait for BC2 to exit so that we can delete the views" );
-
 
205
System ( $BC2, $path1, $path2 );
234
System ( $DiffProg, @DiffArgs, $path1, $path2 );
206
exit 0;
235
exit 0;
207
 
236
 
208
#-------------------------------------------------------------------------------
237
#-------------------------------------------------------------------------------
209
# Function        : create_view
238
# Function        : create_view
210
#
239
#
Line 436... Line 465...
436
 Options:
465
 Options:
437
    -help              - brief help message
466
    -help              - brief help message
438
    -help -help        - Detailed help message
467
    -help -help        - Detailed help message
439
    -man               - Full documentation
468
    -man               - Full documentation
440
    -check             - Perform MD5SUM over both views
469
    -check             - Perform MD5SUM over both views
-
 
470
    -[no]diff          - Force the use of a 'diff' utility
441
    -old=tag           - Old VcsTag (or dir=path)
471
    -old=tag           - Old VcsTag (or dir=path)
442
    -new=tag           - New VcsTag (or dir=path)
472
    -new=tag           - New VcsTag (or dir=path)
443
 
473
 
444
=head1 OPTIONS
474
=head1 OPTIONS
445
 
475
 
Line 459... Line 489...
459
 
489
 
460
=item B<-check>
490
=item B<-check>
461
 
491
 
462
This option controls the mode in which the program will operate.
492
This option controls the mode in which the program will operate.
463
 
493
 
464
If enabled the prgram will perform an MD5 Cheksum over the files in the first
494
If enabled the program will perform an MD5 Cheksum over the files in the first
465
view and compare that with files in the second view.
495
view and compare that with files in the second view.
466
 
496
 
-
 
497
This option cannot be used in conjunction with the '-diff' option'.
-
 
498
 
-
 
499
=item B<-diff>
-
 
500
 
-
 
501
This option controls the mode in which the program will operate.
-
 
502
 
467
If not enabled, then the program will invoke BeyondCompare to perform a visual
503
By default the program is Operating System dependent. It will:
-
 
504
 
-
 
505
=over 4
-
 
506
 
-
 
507
=item * Windows - Use Beyond Compare
-
 
508
 
-
 
509
=item * Unix - Use gdiff or diff
-
 
510
 
-
 
511
=back
-
 
512
 
468
difference between the two views. This operation is only supported under
513
This option will force the use of a 'diff' utility on both Windows and
469
Windows.
514
Unix.
-
 
515
 
-
 
516
This option cannot be used in conjunction with the '-check' option'.
470
 
517
 
471
=item B<-old=tag>
518
=item B<-old=tag>
472
 
519
 
473
This option specifies the old, or base, VcsTag for the difference report. This
520
This option specifies the old, or base, VcsTag for the difference report. This
474
tag is mandatory.
521
tag is mandatory.
Line 498... Line 545...
498
 
545
 
499
=over 4
546
=over 4
500
 
547
 
501
=item 1 MD5Sum of the two views
548
=item 1 MD5Sum of the two views
502
 
549
 
-
 
550
=item 2 Invoke a differencing program.
-
 
551
 
-
 
552
The program that is invoked is, by default, Operating System dependent. It will:
-
 
553
 
-
 
554
=over 4
-
 
555
 
503
=item 2 Invoke BeyondCompare to perform a visual diff.
556
=item * Windows - Use Beyond Compare to perform a visual diff.
504
 
557
 
505
This mode simplifies the process of perform a code review between two
558
This mode simplifies the process of perform a code review between two
506
VCS Tags by:
559
VCS Tags by:
507
 
560
 
508
=over 8
561
=over 8
Line 519... Line 572...
519
 
572
 
520
Creating a visual difference between two directories.
573
Creating a visual difference between two directories.
521
 
574
 
522
=back
575
=back
523
 
576
 
-
 
577
=item * Unix - Use gdiff or diff
-
 
578
 
-
 
579
=back
-
 
580
 
524
=back
581
=back
525
 
582
 
526
The program will:
583
The program will:
527
 
584
 
528
=over 8
585
=over 8
Line 532... Line 589...
532
Create two 'extract only' views based on the VCS Tags provided. The resultant
589
Create two 'extract only' views based on the VCS Tags provided. The resultant
533
views are not connected to any version control system.
590
views are not connected to any version control system.
534
 
591
 
535
=item *
592
=item *
536
 
593
 
537
Perform the desired operation: MD5Sum or Visual Difference.
594
Perform the desired operation: MD5Sum or Difference.
538
 
595
 
539
=item *
596
=item *
540
 
597
 
541
Delete the created directories the comparison is complete.
598
Delete the created directories the comparison is complete.
542
 
599