examples/lcvs-st

filter: Statementstmt 25.7% 36 / 140 Branchbran 12.5% 7 / 56 Conditioncond 0.0% 0 / 81 MC/DCmcdc 0.0% 0 / 29 Subroutinesub 50.0% 7 / 14 Podpod n/a totaltotal 15.6% 50 / 320 CC 51 SCAR 60.6
CC
51
Cov
16%
print_output
870.0
add_working_file
156.0
add_working_directory
42.0
CRAP 428.9
↑ Summary blib/lib/VCS/LibCVS/Command.pm »
1 #!/usr/bin/perl -w
2 #
3 # Copyright (c) 2003,2004,2005 Alexander Taler (dissent@0--0.org)
4 #
5 # All rights reserved. This program is free software; you can redistribute it
6 # and/or modify it under the same terms as Perl itself.
7 #
8  
9 ###############################################################################
10 ### Report CVS status in a compact format
11 ###############################################################################
12  
13 # This is an example of how to use VCS::LibCVS, but is also a useful tool in
14 # its own right. For usage and explanation of output, use the --help option.
15  
16 ################################################################################
17 ### IMPROVEMENTS
18 ################################################################################
19  
20 ####################
21 ### Add these short forms, print them by default:
22  
23 # U = UUU (up-to-date)
24 # ? = NMU (unknown)
25 # A = AUU (locally added)
26 # R = RUU (locally removed)
27 # M = UMU (locally modified)
28 # C = UCU (unmodified since a merge which resulted in a conflict)
29 # m = UMM (locally and remotely modified, no conflict)
30 # c = UMM (locally and remotely modified, will conflict on merge)
31  
32 # There do exist other states without short forms, such as:
33  
34 # NUM Added in the repository
35 # NMM In the way
36 # AUM been added locally, but already added in repository
37  
38 ####################
39 ### Add these new states:
40  
41 # Admin State:
42 # S Sticky tag or date on this file
43  
44 # Local State:
45 # I The local file is in the way (This really is just an M file when
46 # there is no local revision, but a file in the repository.
47 # i.e. NMM could be written NIM) Might want to distinguish between
48 # one that has been added already.
49  
50 # Repository State:
51 # R The file is dead in the latest revision
52  
53 ####################
54 ### Add these options:
55  
56 # -s=a sort alphabetically
57 # =c order provided on command line
58 # =n print them as they are processed, no waiting
59  
60 # --revision-numbers print revision numbers too
61 # --sticky print sticky tags/dates/revisions too
62 # --branches print branch tags too
63  
64 # --expect-branch find files not on branch ...? different tool maybe
65  
66 ####################
67 ### And other stuff:
68  
69 # Write a man page
70  
71 ###############################################################################
72  
73 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
74 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
75 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
76 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
77  
78 1 ▶use VCS::LibCVS;
Subroutine BEGIN: called CC=1 SCAR=0.0
79  
80 # Various configuration options
81 #$VCS::LibCVS::Cache_Repository = 0;
82 #$VCS::LibCVS::Cache_FileRevision_Contents_by_Repository = 0;
83 #$VCS::LibCVS::Cache_RepositoryFileOrDirectory = 0;
84 #$VCS::LibCVS::Client::Connection::Pserver::Search_CvsPass = 1;
85 #$VCS::LibCVS::Client::Connection::Pserver::Prompt = 1;
86 #$VCS::LibCVS::Client::Connection::Pserver::Store_CvsPass =1;
87  
88 ###############################################################################
89 ### Command line arguments processing
90 # Any arguments that remain after this are file or directory names
91 ###############################################################################
92  
93 #
94 # Commands
95 #
96  
97 1 my ($cmd_help, $cmd_version);
98  
99 #
100 # Options
101 #
102  
103 # $opt_mod_state determines which files to report on, based on their
104 # modification state. Look in the help for possible values.
105 1 my $opt_mod_state = "all";
106  
107 # $opt_dont_recurse indicates whether or not to recurse into subdirectories
108 1 my $opt_dont_recurse = '';
109  
110 # $opt_debug indicates how much debugging information to generate
111 1 my $opt_debug = 0;
112  
113 # $opt_debugfile indicates where to put the debugging output. undef for STDERR
114 1 my $opt_debugfile;
115  
116 1 ▶if (! GetOptions("help|h" => \$cmd_help,
Branch: 1 branch
BranchTrueFalseTotal
unless (&GetOptions("help|h", \$cmd_help, "version", \$cmd_version, "modified-state|m=s", \$opt_mod_state, "local|l", \$opt_dont_recurse, "debug=i", \$opt_debug, "debugfile=s", \$opt_debugfile)) 0 1 1
117 "version" => \$cmd_version,
118 "modified-state|m=s" => \$opt_mod_state,
119 "local|l" => \$opt_dont_recurse,
120 "debug=i" => \$opt_debug,
121 "debugfile=s" => \$opt_debugfile,
122 )) {
123 0 $cmd_help = 1;
124 }
125  
126 #
127 # Handle debugging options
128 #
129  
130 # IO::File object to which debugging messages are written
131 # used in sub debug_out
132 1 my $debugfile;
133  
134 1 ▶if ($opt_debug > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt_debug > 0) 0 1 1
135 0 ▶ if (defined $opt_debugfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $opt_debugfile) { } 0 0 0
136 0 $debugfile = IO::File->new(">> $opt_debugfile");
137 } else {
138 0 $debugfile = IO::Handle->new_from_fd(fileno(STDERR), ">>");
139 }
140  
141 # Turn on Client debugging
142 0 $VCS::LibCVS::Client::DebugOut = $opt_debugfile;
143  
144 0 ▶ if ($opt_debug >= 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt_debug >= 4) 0 0 0
145 0 $VCS::LibCVS::Client::DebugLevel = VCS::LibCVS::Client::DEBUG_OPTIONS;
146 }
147 0 ▶ if ($opt_debug >= 9) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt_debug >= 9) 0 0 0
148 0 $VCS::LibCVS::Client::DebugLevel = VCS::LibCVS::Client::DEBUG_PROTOCOL;
149 }
150 }
151  
152 # Name of the program
153 1 my ($prog_name) = ($0 =~ /.*[\\\/](.*)/);
154  
155 # Check for non-default commands
156 1 ▶if ($cmd_version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd_version) 0 1 1
157 0 print '$Header: /cvsroot/libcvs-perl/libcvs-perl/examples/lcvs-st,v 1.29 2005/10/10 12:52:12 dissent Exp $ ', "\n";
158 0 print "VCS::LibCVS::VERSION = $VCS::LibCVS::VERSION\n";
159 0 exit;
160 }
161  
162 1 ▶if ($cmd_help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd_help) 0 1 1
163 0 print
164 "Report CVS status in a compact format
165  
166 $prog_name [--version] [--help|-h]
167 $prog_name [options] [<file or dir names . . .>]
168  
169 Report the status of the specified files, and files in the specified
170 directories. If no files or directories are specified, the current working
171 directory is assumed. The output looks like this:
172  
173 UUU up-to-date-file
174 UMU locally-modified-file
175 UUM file-modified-in-repository
176 NMU unknown-file
177  
178 The status of the files is specified by the first three characters, whose
179 meaning, from left to right, is:
180  
181 1. Local Admin State -- What's stored in CVS/Entries
182 (N)one Nothing is known locally about the file
183 (U)Available File is associated with a revision in the repository
184 (A)dded Locally registered for addition
185 (R)emoved Locally registered for removal
186  
187 2. Local State of file compared with Local Admin state
188 (U)p-To-Date File is locally unmodified
189 a(B)sent The file is locally missing
190 (M)odified File is modified from its associated revision
191 (C)onflict Last merge resulted in conflicts, and the file hasn't
192 been modified since
193  
194 3. Repository State of file compared with Local Admin state
195 (U)p-To-Date Local Revision is the latest.
196 a(B)sent Should be in the repository, but isn't.
197 (M)odified Local revision is not the latest.
198 Will (C)onflict Changes in the repository conflict with local changes.
199  
200 Options:
201  
202 --modified-state=<all|modified|locally-modified|remotely-modified|conflict>
203 -m=<a|m|l|r|c>
204  
205 Print only files with the specified state.
206 'all' includes unmodified files.
207 'locally-modifed' are those with a local admin state of A or R,
208 or a local admin state of U and a local state of B, M, or C,
209 or a local admin state of N and a repository state of U.
210 'remotely-modifed' are those with a repository state of B, M or C.
211 'modified' are those which are remotely or locally modified.
212 'conflict' are those with local or repository state C,
213 as well as several other 'inconsistent' states.
214  
215 --local -l Don't recurse into subdirectories.
216 --debug=[0-9] Level of debugging information to print (9 is most).
217 0 "; exit; }
218  
219 ###############################################################################
220 ### Start of code
221 ###############################################################################
222  
223 ####################
224 # As files and directories specified on the command line are processed,
225 # information about each file is stored in a hash. Once all arguments are
226 # processed, the hash is culled according to any options provided. Finally
227 # information is printed, in the requested order.
228 ####################
229  
230 # Hash to store information on the files
231 # Keys are the filenames, data are hash refs with the following keys:
232 # Name => The name of the file
233 # LAdmin => The local administrative state
234 # LState => the local state of the file
235 # RState => the repository state of the file
236 1 my %st_info;
237  
238 # If no files or directories were specified, assume the current directory
239 1 ▶push(@ARGV, ".") if (@ARGV == 0);
Branch: 1 branch
BranchTrueFalseTotal
if @ARGV == 0 1 0 1
240  
241 1 foreach my $arg (@ARGV) {
242 1 ▶ if (-d $arg) {
Branch: 2 branches
BranchTrueFalseTotal
if (-d $arg) { } 1 0 1
elsif (-f $arg) { } 0 0 0
243 1 process_directory($arg);
244 } elsif (-f $arg) {
245 0 process_file($arg);
246 } else {
247 # Doesn't exist locally, perhaps it's in the repository though
248 0 process_missing($arg);
249 }
250 }
251  
252 0 print_output();
253  
254 0 exit;
255  
256 ###############################################################################
257 ### Debug output
258 ###############################################################################
259  
260 # Arg 1: debug level
261 # The rest of the args are passed to print
262 1 ▶sub debug_out {
Subroutine debug_out: called CC=2 SCAR=9.2
263 1 my $level = shift;
264 1 ▶ if ($opt_debug >= $level) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt_debug >= $level) 0 1 1
265 0 $debugfile->print(@_);
266 0 $debugfile->flush;
267 }
268 }
269  
270 ###############################################################################
271 ### process_* routines
272 # These are used for processing stuff specified on the command line
273 ###############################################################################
274  
275 1 ▶sub process_directory {
Subroutine process_directory: called CC=1 SCAR=0.2
276 1 my $dir_name = shift;
277  
278 1 debug_out(1, "process_directory: $dir_name\n");
279  
280 # Construct a VCS::LibCVS::WorkingDirectory for this directory.
281 1 my $l_dir = VCS::LibCVS::WorkingDirectory->new($dir_name);
282  
283 0 add_working_directory($l_dir);
284 }
285  
286 0 ▶sub process_file {
Subroutine process_file: not called CC=3 SCAR=24.8
287 0 my $file_name = shift;
288  
289 0 debug_out(1, "process_file: $file_name\n");
290  
291 # Figure out if it's a CVS managed file or not
292 # One of these routines will throw an exception
293 # If both do, then it's an ignored file, so say nothing
294 0 my $l_file; # If it's managed by CVS
295 my $u_file; # If it's not managed by CVS
296 0 eval { $l_file = VCS::LibCVS::WorkingFile->new($file_name); };
297 0 eval { $u_file = VCS::LibCVS::WorkingUnmanagedFile->new($file_name); };
298  
299 0 ▶ add_working_file($l_file) if ($l_file);
Branch: 1 branch
BranchTrueFalseTotal
if $l_file 0 0 0
300 0 ▶ add_unmanaged_file($u_file) if ($u_file);
Branch: 1 branch
BranchTrueFalseTotal
if $u_file 0 0 0
301  
302 0 return;
303 }
304  
305 # A filename that couldn't be found locally, it might be registered and absent,
306 # or in the repository. It could be a file or directory.
307  
308 # XXX when processing missing files deep in the tree, there is a challenge of
309 # finding the right parent directory. Best to start as deep as possible and
310 # work back.
311  
312 # To simplify our life, we assume that the missing thing is a file. If it's
313 # locally registered into CVS, then process_file() will handle it fine. If
314 # it's not, then we find its parent directory on the local file system, and use
315 # it to look for the missing file in the repo. If its parent directory doesn't
316 # exist, then we ignore it.
317 0 ▶sub process_missing {
Subroutine process_missing: not called CC=3 SCAR=24.8
318 0 my $file_name = shift;
319  
320 0 debug_out(1, "process_missing: $file_name\n");
321  
322 # Handle the easy case of a local file that's missing
323 0 process_file($file_name);
324 0 ▶ return if ($st_info{$file_name});
Branch: 1 branch
BranchTrueFalseTotal
if $st_info{$file_name} 0 0 0
325  
326  
327 # Find the parent directory
328 0 my ($path_v, $path_d, $path_f) = File::Spec->splitpath($file_name);
329  
330 # If there's no directory name, it must be the current dir.
331 0 ▶ $path_d ||= File::Spec->curdir;
Condition0%0/3
$path_d ||= "File::Spec"->curdir
l!l&&r!l&&!r
000
MC/DC0%0/2
$path_d ||= "File::Spec"->curdir
$path_d "File::Spec"->curdir
Truth table0%0/3
A ||= B
A= $path_dB= "File::Spec"->curdir
ABresult
1X1
011
000
332  
333 0 my $l_dir = VCS::LibCVS::WorkingDirectory->new($path_d);
334 0 my $r_dir = $l_dir->get_remote_object();
335  
336 # Get the RepositoryFile object, and add it.
337 0 add_repository_file($r_dir->get_file($path_f), $file_name);
338 }
339  
340 ###############################################################################
341 ### add_* routines
342 # Used to add information from LibCVS objects to %st_info information.
343 ###############################################################################
344  
345 # Pass it a WorkingFile object
346 0 ▶sub add_working_file {
Subroutine add_working_file: not called CC=12 SCAR=50.5
347 0 my $l_file = shift;
348  
349 0 debug_out(1, "add_working_file: " . $l_file->get_name() . "\n");
350  
351 0 my %f_info;
352 0 $f_info{Name} = $l_file->get_name();
353  
354 # Get local admin state from scheduled actions
355 0 my $action = $l_file->get_scheduled_action();
356 0 ▶ $f_info{LAdmin} = "U" if $action == VCS::LibCVS::WorkingFile::ACTION_NONE;
Branch: 1 branch
BranchTrueFalseTotal
if $action == 0 0 0 0
357 0 ▶ $f_info{LAdmin} = "A" if $action == VCS::LibCVS::WorkingFile::ACTION_ADD;
Branch: 1 branch
BranchTrueFalseTotal
if $action == 1 0 0 0
358 0 ▶ $f_info{LAdmin} = "R" if $action == VCS::LibCVS::WorkingFile::ACTION_REMOVE;
Branch: 1 branch
BranchTrueFalseTotal
if $action == 2 0 0 0
359  
360 # Get local state
361 0 my $state = $l_file->get_state();
362 0 ▶ $f_info{LState} = "U" if $state == VCS::LibCVS::WorkingFile::STATE_UPTODATE;
Branch: 1 branch
BranchTrueFalseTotal
if $state == 0 0 0 0
363 0 ▶ $f_info{LState} = "M" if $state == VCS::LibCVS::WorkingFile::STATE_MODIFIED;
Branch: 1 branch
BranchTrueFalseTotal
if $state == 1 0 0 0
364 0 ▶ $f_info{LState} = "C" if $state == VCS::LibCVS::WorkingFile::STATE_HADCONFLICTS;
Branch: 1 branch
BranchTrueFalseTotal
if $state == 2 0 0 0
365 0 ▶ $f_info{LState} = "B" if $state == VCS::LibCVS::WorkingFile::STATE_ABSENT;
Branch: 1 branch
BranchTrueFalseTotal
if $state == 3 0 0 0
366  
367 # Get repository state
368 0 my $rstate = $l_file->get_rstate();
369 0 ▶ $f_info{RState} = "U" if $rstate == VCS::LibCVS::WorkingFile::STATE_UPTODATE;
Branch: 1 branch
BranchTrueFalseTotal
if $rstate == 0 0 0 0
370 0 ▶ $f_info{RState} = "M" if $rstate == VCS::LibCVS::WorkingFile::STATE_MODIFIED;
Branch: 1 branch
BranchTrueFalseTotal
if $rstate == 1 0 0 0
371 0 ▶ $f_info{RState} = "B" if $rstate == VCS::LibCVS::WorkingFile::STATE_ABSENT;
Branch: 1 branch
BranchTrueFalseTotal
if $rstate == 3 0 0 0
372 0 ▶ $f_info{RState} = "C" if $rstate == VCS::LibCVS::WorkingFile::STATE_WILLCONFLICT;
Branch: 1 branch
BranchTrueFalseTotal
if $rstate == 4 0 0 0
373  
374 # Shove it into the hash ref
375 0 $st_info{$f_info{Name}} = \%f_info;
376 0 return;
377 }
378  
379 # Pass it an UnmanagedFile object
380 0 ▶sub add_unmanaged_file {
Subroutine add_unmanaged_file: not called CC=2 SCAR=17.9
381 0 my $u_file = shift;
382  
383 0 debug_out(1, "add_unmanaged_file: " . $u_file->get_name() . "\n");
384  
385 0 my %f_info;
386 0 $f_info{Name} = $u_file->get_name();
387  
388 # Local admin is always N
389 0 $f_info{LAdmin} = "N";
390  
391 # Local state is always M
392 0 $f_info{LState} = "M";
393  
394 # Get repository state
395 0 ▶ $f_info{RState} = $u_file->is_in_the_way() ? "M" : "U";
Branch: 1 branch
BranchTrueFalseTotal
$u_file->is_in_the_way ? : 0 0 0
396  
397 # Shove it into the hash ref
398 0 $st_info{$f_info{Name}} = \%f_info;
399 0 return;
400 }
401  
402 # Pass it a WorkingDirectory object
403 # A working directory isn't added directly, but files in it are.
404 0 ▶sub add_working_directory {
Subroutine add_working_directory: not called CC=6 SCAR=37.4
405 0 my $w_dir = shift;
406  
407 0 debug_out(1, "add_working_directory: " . $w_dir->get_name() . "\n");
408  
409 ####################
410 # Add entries to %st_info for each file in a directory.
411 #
412 # There are three lists of files that are of interest:
413 # 1] Files in the repository: Those files with non-dead revisions at the tip
414 # of the sticky branch or trunk.
415 # 2] Local CVS files: Files which have been checked out of CVS already, as
416 # well as files scheduled for addition.
417 # 3] Local unmanaged files: Local files not recognized by CVS (neither added
418 # nor ignored.)
419 #
420 # Of course, the same file may appear in 1] as well as 2] or maybe 3], so the
421 # lists are handled in the following way (NB. By traverse I mean: add entries
422 # to st_info for each file in the list.):
423 # + List 1] is fetched from LibCVS.
424 # + List 2] is fetched from LibCVS.
425 # + List 2] is traversed. Any file also present in 1] is deleted from 1]
426 # + List 3] is fetched from LibCVS.
427 # + List 3] is traversed. Any file also present in 1] is deleted from 1]
428 # + The shortened list 1] is traversed.
429 ####################
430  
431 # Get the list of files in the repository. (list 1] above)
432 0 my $dir_branch = $w_dir->get_directory_branch();
433 0 my $r_files = $dir_branch->get_file_branches();
434  
435 # Get the list of local CVS managed files in this directory. (list 2] above)
436 0 my $l_files = $w_dir->get_files();
437 0 foreach my $l_file_name (keys %$l_files) {
438 0 add_working_file($l_files->{$l_file_name});
439 # Remove from the remote file list
440 0 delete($r_files->{$l_file_name});
441 }
442  
443 # Get the list of unmanaged files. (list 3] above)
444 0 my $u_files = $w_dir->get_unmanaged_files();
445 0 foreach my $u_file_name (keys %$u_files) {
446 0 add_unmanaged_file($u_files->{$u_file_name});
447 # Remove from the remote file list
448 0 delete($r_files->{$u_file_name});
449 }
450  
451 # Process the remaining remote files (list 1] above)
452 0 foreach my $r_filename (keys %$r_files) {
453 0 $r_filename = File::Spec::Unix->catfile($w_dir->get_name(), $r_filename);
454 0 $r_filename = File::Spec::Unix->canonpath($r_filename);
455 0 $st_info{$r_filename} = { Name => $r_filename,
456 LAdmin => "N",
457 LState => "U",
458 RState => "M" };
459 }
460  
461 ####################
462 # Recurse into subdirectories
463 ####################
464 0 ▶ if (! $opt_dont_recurse) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $opt_dont_recurse) 0 0 0
465 0 my $s_dirs = $w_dir->get_directories();
466 0 foreach my $s_dir (values %$s_dirs) {
467 0 add_working_directory($s_dir);
468 }
469 }
470 }
471  
472 # Pass it a RepositoryFile object, and its local name
473 0 ▶sub add_repository_file {
Subroutine add_repository_file: not called CC=1 SCAR=6.9
474 0 my $r_file = shift;
475 0 my $l_name = shift;
476  
477 0 debug_out(1, "add_repository_file: " . $r_file->get_name() . "\n");
478  
479 0 my %f_info;
480 0 $f_info{Name} = $l_name;
481  
482 # Local admin is always N
483 0 $f_info{LAdmin} = "N";
484  
485 # Local state is always U
486 0 $f_info{LState} = "U";
487  
488 # Repository state is always M
489 0 $f_info{RState} = "M";
490  
491 # Shove it into the hash ref
492 0 $st_info{$f_info{Name}} = \%f_info;
493 0 return;
494 }
495  
496 ###############################################################################
497 ### Print routine
498 ###############################################################################
499 0 ▶sub print_output {
Subroutine print_output: not called CC=29 SCAR=67.7
500 # Print output
501 0 foreach my $file_name (sort keys %st_info) {
502 0 my $f_info = $st_info{$file_name};
503 0 $f_info->{State} = $f_info->{LAdmin}.$f_info->{LState}.$f_info->{RState};
504  
505 0 ▶ if ( ($opt_mod_state =~ /^(all|a)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ or $opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(modified|m)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ || $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(conflict|c)$/ and $f_info->{"LState"} =~ /C/ || $f_info->{"RState"} =~ /C/ || $f_info->{"LAdmin"} =~ /[AR]/ && !($f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/) || ($f_info->{"LState"} =~ /B/ || $f_info->{"RState"} =~ /B/) || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"LState"} =~ /M/ && $f_info->{"RState"} =~ /M/) 0 0 0
Condition0%0/78
$opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ or $opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(modified|m)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ || $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(conflict|c)$/ and $f_info->{"LState"} =~ /C/ || $f_info->{"RState"} =~ /C/ || $f_info->{"LAdmin"} =~ /[AR]/ && !($f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/) || ($f_info->{"LState"} =~ /B/ || $f_info->{"RState"} =~ /B/) || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"LState"} =~ /M/ && $f_info->{"RState"} =~ /M/
l!l&&r!l&&!r
000
$opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ or $opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(modified|m)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ || $f_info->{"RState"} =~ /[BMC]/
l!l&&r!l&&!r
000
$opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ or $opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/
l!l&&r!l&&!r
000
$opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/
l!l&&r!l&&!r
000
$opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/
!ll&&!rl&&r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/ or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/ or $f_info->{"LAdmin"} =~ /[AR]/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/ or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/
!ll&&!rl&&r
000
$f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/
!ll&&!rl&&r
000
$opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/
!ll&&!rl&&r
000
$opt_mod_state =~ /^(modified|m)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ || $f_info->{"RState"} =~ /[BMC]/
!ll&&!rl&&r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/ or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/ or $f_info->{"LAdmin"} =~ /[AR]/ or $f_info->{"RState"} =~ /[BMC]/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/ or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/ or $f_info->{"LAdmin"} =~ /[AR]/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/ or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /U/ and $f_info->{"LState"} =~ /[BMC]/
!ll&&!rl&&r
000
$f_info->{"LAdmin"} =~ /N/ and $f_info->{"RState"} =~ /[U]/
!ll&&!rl&&r
000
$opt_mod_state =~ /^(conflict|c)$/ and $f_info->{"LState"} =~ /C/ || $f_info->{"RState"} =~ /C/ || $f_info->{"LAdmin"} =~ /[AR]/ && !($f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/) || ($f_info->{"LState"} =~ /B/ || $f_info->{"RState"} =~ /B/) || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"LState"} =~ /M/ && $f_info->{"RState"} =~ /M/
!ll&&!rl&&r
000
$f_info->{"LState"} =~ /C/ or $f_info->{"RState"} =~ /C/ or $f_info->{"LAdmin"} =~ /[AR]/ and not $f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/ or ($f_info->{"LState"} =~ /B/ or $f_info->{"RState"} =~ /B/) or $f_info->{"LAdmin"} =~ /N/ and $f_info->{"LState"} =~ /M/ and $f_info->{"RState"} =~ /M/
l!l&&r!l&&!r
000
$f_info->{"LState"} =~ /C/ or $f_info->{"RState"} =~ /C/ or $f_info->{"LAdmin"} =~ /[AR]/ and not $f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/ or ($f_info->{"LState"} =~ /B/ or $f_info->{"RState"} =~ /B/)
l!l&&r!l&&!r
000
$f_info->{"LState"} =~ /C/ or $f_info->{"RState"} =~ /C/ or $f_info->{"LAdmin"} =~ /[AR]/ and not $f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/
l!l&&r!l&&!r
000
$f_info->{"LState"} =~ /C/ or $f_info->{"RState"} =~ /C/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /[AR]/ and not $f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/
!ll&&!rl&&r
000
$f_info->{'LState'} =~ /U/ && $f_info->{'RState'} =~ /U/
!ll&&!rl&&r
000
$f_info->{"LState"} =~ /B/ or $f_info->{"RState"} =~ /B/
l!l&&r!l&&!r
000
$f_info->{"LAdmin"} =~ /N/ and $f_info->{"LState"} =~ /M/ and $f_info->{"RState"} =~ /M/
!ll&&!rl&&r
000
$f_info->{"LAdmin"} =~ /N/ and $f_info->{"LState"} =~ /M/
!ll&&!rl&&r
000
MC/DC0%0/27
$opt_mod_state =~ /^(all|a)$/ or $opt_mod_state =~ /^(locally-modified|l)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ or $opt_mod_state =~ /^(remotely-modified|r)$/ and $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(modified|m)$/ and $f_info->{"LAdmin"} =~ /U/ && $f_info->{"LState"} =~ /[BMC]/ || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"RState"} =~ /[U]/ || $f_info->{"LAdmin"} =~ /[AR]/ || $f_info->{"RState"} =~ /[BMC]/ or $opt_mod_state =~ /^(conflict|c)$/ and $f_info->{"LState"} =~ /C/ || $f_info->{"RState"} =~ /C/ || $f_info->{"LAdmin"} =~ /[AR]/ && !($f_info->{"LState"} =~ /U/ && $f_info->{"RState"} =~ /U/) || ($f_info->{"LState"} =~ /B/ || $f_info->{"RState"} =~ /B/) || $f_info->{"LAdmin"} =~ /N/ && $f_info->{"LState"} =~ /M/ && $f_info->{"RState"} =~ /M/
too many conditions
506 || (($opt_mod_state =~ /^(locally-modified|l)$/)
507 && ((($f_info->{LAdmin} =~ /U/) && ($f_info->{LState} =~ /[BMC]/))
508 || (($f_info->{LAdmin} =~ /N/) && ($f_info->{RState} =~ /[U]/))
509 || ($f_info->{LAdmin} =~ /[AR]/)))
510 || (($opt_mod_state =~ /^(remotely-modified|r)$/)
511 && ($f_info->{RState} =~ /[BMC]/))
512 || (($opt_mod_state =~ /^(modified|m)$/)
513 && ((($f_info->{LAdmin} =~ /U/) && ($f_info->{LState} =~ /[BMC]/))
514 || (($f_info->{LAdmin} =~ /N/) && ($f_info->{RState} =~ /[U]/))
515 || ($f_info->{LAdmin} =~ /[AR]/)
516 || ($f_info->{RState} =~ /[BMC]/)))
517 || (($opt_mod_state =~ /^(conflict|c)$/)
518 # This reports more than just merge conflicts.
519 # It includes many other probably wrong states.
520 && (($f_info->{LState} =~ /C/)
521 || ($f_info->{RState} =~ /C/)
522 # If it's added or removed, nothing else should be changed
523 || (($f_info->{LAdmin} =~ /[AR]/) &&
524 (($f_info->{LState} !~ /U/) || ($f_info->{RState} !~ /U/)))
525 # If a file is absent, it's bad
526 || (($f_info->{LState} =~ /B/) || ($f_info->{RState} =~ /B/))
527 # No local admin, but exists locally and remotely is bad
528 || (($f_info->{LAdmin} =~ /N/)
529 && ($f_info->{LState} =~ /M/)
530 && ($f_info->{RState} =~ /M/))
531 ))) {
532 0 print($f_info->{State} . " " . $f_info->{Name} . "\n");
533 }
534 }
535 }
↑ Summary blib/lib/VCS/LibCVS/Command.pm »