Subversion Repositories DevTools

Rev

Rev 7213 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7213 Rev 7214
Line 42... Line 42...
42
my $opt_mode;
42
my $opt_mode;
43
my $opt_diff;
43
my $opt_diff;
44
my $opt_rtag_id;
44
my $opt_rtag_id;
45
my $opt_package_name;
45
my $opt_package_name;
46
my @opt_options;
46
my @opt_options;
-
 
47
my $opt_patch;
47
 
48
 
48
#
49
#
49
#   Globals - Provided by the JATS environment
50
#   Globals - Provided by the JATS environment
50
#
51
#
51
my $USER            = $ENV{'USER'};
52
my $USER            = $ENV{'USER'};
Line 93... Line 94...
93
                'check'             => \$opt_md5check,          # Force MD5 Check
94
                'check'             => \$opt_md5check,          # Force MD5 Check
94
                'diff!'             => \$opt_diff,              # Force use of diff
95
                'diff!'             => \$opt_diff,              # Force use of diff
95
                "rtagid|rtag_id=s"  => \$opt_rtag_id,           # Release tag needed for release extractions
96
                "rtagid|rtag_id=s"  => \$opt_rtag_id,           # Release tag needed for release extractions
96
                "package=s"         => \$opt_package_name,      # Name of the package to query
97
                "package=s"         => \$opt_package_name,      # Name of the package to query
97
                'option=s'          => \@opt_options,           # User options
98
                'option=s'          => \@opt_options,           # User options
-
 
99
                'patch:s'           => \$opt_patch,             # Generate a patch file ( for FeCru )
98
                );
100
                );
99
 
101
 
100
                #
102
                #
101
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
103
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
102
                #
104
                #
Line 115... Line 117...
115
#
117
#
116
ErrorConfig( 'name'    => 'VCSDIFF',
118
ErrorConfig( 'name'    => 'VCSDIFF',
117
             'verbose' => $opt_verbose,
119
             'verbose' => $opt_verbose,
118
             'debug'   => $opt_debug );
120
             'debug'   => $opt_debug );
119
 
121
 
-
 
122
#
-
 
123
#   Sanity testing of user options
-
 
124
#   
120
Error ("Options -check and -diff cannot be combined")
125
Error ("Options -check and -diff cannot be combined")
121
    if ( $opt_md5check && $opt_diff );
126
    if ( $opt_md5check && $opt_diff );
-
 
127
Error ("Options -check and -patch cannot be combined")
-
 
128
    if ( $opt_md5check && defined($opt_patch) );
-
 
129
Error ("Options -diff and -patch cannot be combined")
-
 
130
    if ( $opt_diff && defined($opt_patch) );
122
 
131
 
123
#
132
#
124
#   Determine mode
133
#   Determine mode
125
#   Not all modes work on all machines
134
#   Not all modes work on all machines
126
#
135
#
127
Verbose ("Machine Type: UNIX=$UNIX");
136
Verbose ("Machine Type: UNIX=$UNIX");
128
if ( $opt_md5check )
137
if ( $opt_md5check )
129
{
138
{
130
    $opt_mode = 'md5';
139
    $opt_mode = 'md5';
131
}
140
}
132
elsif ( $UNIX || $opt_diff )
141
elsif ( $UNIX || $opt_diff || defined($opt_patch))
133
{
142
{
134
    $opt_mode = 'diff';
143
    $opt_mode = 'diff';
135
    $Name = 'diff';
144
    $Name = 'diff';
136
    push @DiffArgs, '-r';
145
    push @DiffArgs, '-r';
137
    $Name = 'gdiff';
146
    $Name = 'gdiff';
138
    $DiffProg = LocateProgInPath( $Name, '--All');
147
    $DiffProg = LocateProgInPath( $Name, '--All');
139
    unless ( $DiffProg =~ m~/~ )
148
    unless ( $DiffProg =~ m~/~ )
140
    {
149
    {
141
        $Name = 'diff';
150
        $Name = 'diff';
142
        $DiffProg = LocateProgInPath( $Name, '--All');
151
        $DiffProg = LocateProgInPath( $Name, '--All');
-
 
152
 
143
    }
153
    }
144
 
154
 
145
    Error ("Cannot locate a 'diff' utility in the users PATH")
155
    Error ("Cannot locate a 'diff' utility in the users PATH")
146
        unless ( $DiffProg =~ m~/~ );
156
        unless ( $DiffProg =~ m~/~ );
-
 
157
    $DiffProg =~ tr~\\~/~;
147
}
158
}
148
else
159
else
149
{
160
{
150
    $opt_mode = 'bc2';
161
    $opt_mode = 'bc2';
151
    $DiffWait = 1;
162
    $DiffWait = 1;
Line 195... Line 206...
195
#
206
#
196
Error ("TMP not found or not a directory")
207
Error ("TMP not found or not a directory")
197
    unless ( $TMP && -d $TMP );
208
    unless ( $TMP && -d $TMP );
198
$TMP = "$TMP/$$";
209
$TMP = "$TMP/$$";
199
 
210
 
-
 
211
#   Validate the users patch directory
-
 
212
if (defined($opt_patch))
-
 
213
{
-
 
214
    # Set deafult patch file name, if none is provided
-
 
215
    $opt_patch = 'vcsdiff.patch' if (length $opt_patch == 0);
-
 
216
    my $patchDir = StripFileExt($opt_patch);
-
 
217
    Error ("Directory does not exist: $patchDir") if length($patchDir) > 0;
-
 
218
    RmDirTree ($opt_patch);
-
 
219
}
-
 
220
 
200
#
221
#
201
#   Translate special label names.
222
#   Translate special label names.
202
#
223
#
203
$opt_old_label = translateSpecialLabelName( "old", $opt_old_label );
224
$opt_old_label = translateSpecialLabelName( "old", $opt_old_label );
204
$opt_new_label = translateSpecialLabelName( "new", $opt_new_label );
225
$opt_new_label = translateSpecialLabelName( "new", $opt_new_label );
Line 240... Line 261...
240
                '-rootdir', $path2 ) unless $rv;
261
                '-rootdir', $path2 ) unless $rv;
241
 
262
 
242
    exit $rv;
263
    exit $rv;
243
}
264
}
244
 
265
 
-
 
266
if ( defined($opt_patch))
-
 
267
{
-
 
268
    Verbose ("Creating a Patch File");
-
 
269
    Verbose ("Diff Utility: $DiffProg");
-
 
270
    @DiffArgs = qw(-U10000 -uNr -x.svn -x.git);
-
 
271
    my $rv = System ( '--Shell', $DiffProg, @DiffArgs, split(/,/, join (',', @opt_options)), $path1, $path2, '>', $opt_patch );
-
 
272
 
-
 
273
    #
-
 
274
    #   Warn if the patch file cannot be found
-
 
275
    if ( -f $opt_patch) {
-
 
276
        Message("Created patch: $opt_patch");
-
 
277
    } else {
-
 
278
        Error ("Expected patch file not found : $opt_patch");
-
 
279
    }
-
 
280
    exit $rv;
-
 
281
}
-
 
282
 
245
#
283
#
246
#   Diffing the paths
284
#   Diffing the paths
247
#   Will use BeyondCompare under Windows
285
#   Will use BeyondCompare under Windows
248
#   Will use diff under unix
286
#   Will use diff under unix
249
#
287
#
Line 697... Line 735...
697
 Options:
735
 Options:
698
    -help               - Brief help message
736
    -help               - Brief help message
699
    -help -help         - Detailed help message
737
    -help -help         - Detailed help message
700
    -man                - Full documentation
738
    -man                - Full documentation
701
    -check              - Perform MD5SUM over both views
739
    -check              - Perform MD5SUM over both views
-
 
740
    -patch[=name]       - Create a patch file for the views
702
    -[no]diff           - Force the use of a 'diff' utility
741
    -[no]diff           - Force the use of a 'diff' utility
703
    -option=opt1,...    - Add user options to the command line
742
    -option=opt1,...    - Add user options to the command line
704
    -old=tag            - Old VcsTag (or path or vcs keyword)
743
    -old=tag            - Old VcsTag (or path or vcs keyword)
705
    -new=tag            - New VcsTag (or path or vcs keyword)
744
    -new=tag            - New VcsTag (or path or vcs keyword)
706
    -rtagid=xxx         - Specify the Release to process
745
    -rtagid=xxx         - Specify the Release to process
Line 729... Line 768...
729
If enabled the program will perform an MD5 Cheksum over the files in the first
768
If enabled the program will perform an MD5 Cheksum over the files in the first
730
view and compare that with files in the second view.
769
view and compare that with files in the second view.
731
 
770
 
732
This option cannot be used in conjunction with the '-diff' option'.
771
This option cannot be used in conjunction with the '-diff' option'.
733
 
772
 
-
 
773
=item B<-patch[=name]>
-
 
774
 
-
 
775
This option controls the mode in which the program will operate. If enabled the program
-
 
776
will generate a 'patch' file between the two views.
-
 
777
 
-
 
778
The patch file can be used to perform a 'Pre-commit' Code Review in tools such as Fisheye/Crucible.
-
 
779
 
-
 
780
If the name of the patch is not provided, the patch will be written to a faile called vcsdiff.patch otherwise
-
 
781
the user specified name will be used. The named patch can be created in a directory that exists.
-
 
782
 
-
 
783
The patch creation process will exclude directories called '.svn' and '.git'.
-
 
784
 
-
 
785
If using a development directory then it is recommended that all build files and artifactes be removed before the
-
 
786
patch is created. This can often be done with a 'jats clobber'.
-
 
787
 
734
=item B<-diff>
788
=item B<-diff>
735
 
789
 
736
This option controls the mode in which the program will operate.
790
This option controls the mode in which the program will operate.
737
 
791
 
738
By default the program is Operating System dependent. It will:
792
By default the program is Operating System dependent. It will:
Line 918... Line 972...
918
 
972
 
919
=head1 EXAMPLE
973
=head1 EXAMPLE
920
 
974
 
921
The following command will compare a Subversion view with a ClearCase view.
975
The following command will compare a Subversion view with a ClearCase view.
922
 
976
 
923
    jats vcsdiff SVN::AUPERASVN02/COTS/crc/tags/crc_26.4.0007.cr@18587 CC::/MASS_Dev_Infra/crc::crc_26.4.0006.cr -check
977
    jats vcsdiff SVN::AUPERASVN01/COTS/crc/tags/crc_26.4.0007.cr@18587 CC::/MASS_Dev_Infra/crc::crc_26.4.0006.cr -check
924
 
978
 
925
The following command will compare a Subversion View with a local directory
979
The following command will compare a Subversion View with a local directory
926
 
980
 
927
    jats vcsdiff SVN::AUPERASVN02/COTS/crc/tags/crc_26.4.0000.cr dir=crc
981
    jats vcsdiff SVN::AUPERASVN01/COTS/crc/tags/crc_26.4.0000.cr dir=crc
928
 
982
 
929
The following command will compare the release version of the ct-spa package from Pulse 2.7.0 with the current head of that package
983
The following command will compare the release version of the ct-spa package from Pulse 2.7.0 with the current head of that package
930
 
984
 
931
    jats vcsdiff -rtagid=38970 -package=ct-spa released head
985
    jats vcsdiff -rtagid=38970 -package=ct-spa released head
932
 
986
 
-
 
987
The following command will create a 'patch' file between the specified version of the crc package and the version in the 
-
 
988
directory named 'crc'.
-
 
989
 
-
 
990
    ats vcsdiff SVN::AUPERASVN01/COTS/crc/tags/crc_26.4.0000.cr dir=crc -patch
-
 
991
 
933
=cut
992
=cut
934
 
993