Subversion Repositories DevTools

Rev

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

Rev 4076 Rev 4086
Line 723... Line 723...
723
    #Information ("WS Results", @ws);
723
    #Information ("WS Results", @ws);
724
    #Information ("DIR Results", @dir);
724
    #Information ("DIR Results", @dir);
725
    #Information ("WS Results: ", scalar @ws);
725
    #Information ("WS Results: ", scalar @ws);
726
    #Information ("DIR Results:", scalar @dir);
726
    #Information ("DIR Results:", scalar @dir);
727
 
727
 
-
 
728
 
728
    #
729
    #
729
    #   Create a hash the Workspace and the User dir
730
    #   Create a hash the Workspace and the User dir
730
    #   The key will be file names
731
    #   The key will be file names
731
    #
732
    #
732
    my %ws;  map ( $ws{$_} = 1 , @ws );
733
    my %ws;  map ( $ws{$_} = 1 , @ws );
733
    my %dir; map ( $dir{$_} = 1 , @dir );
734
    my %dir; map ( $dir{$_} = 1 , @dir );
734
 
735
 
735
    #
736
    #
-
 
737
    #   Create hash of paths to persist
-
 
738
    #       build/*   -> Persist directory. Keep dir tree if not
-
 
739
    #                    being imported, otherwise delete.
-
 
740
    #
-
 
741
    my %persistPaths;
-
 
742
    if ( $opt_mergePaths )
-
 
743
    {
-
 
744
        foreach ( split(',', $opt_mergePaths) )
-
 
745
        {
-
 
746
            if ( m~(.+/)\*$~ )
-
 
747
            {
-
 
748
                my $base = $1;
-
 
749
                $persistPaths{$base} = 1 unless( exists $dir{$base});
-
 
750
            }
-
 
751
        }
-
 
752
        Verbose0("Persist Paths:" , sort keys %persistPaths);
-
 
753
    }
-
 
754
 
-
 
755
    #
736
    #   Create a hash of common elements
756
    #   Create a hash of common elements
737
    #   Removing then from the other two
757
    #   Removing then from the other two
738
    #
758
    #
739
    my %common;
759
    my %common;
740
    foreach ( keys %ws )
760
    foreach ( keys %ws )
Line 774... Line 794...
774
        #   These are of the form xxxxx/
794
        #   These are of the form xxxxx/
775
        #
795
        #
776
        my @newTldPaths;
796
        my @newTldPaths;
777
        if ( $opt_mergePaths )
797
        if ( $opt_mergePaths )
778
        {
798
        {
779
            foreach  ( @rm_files)
799
            foreach (@rm_files)
780
            {
800
            {
781
                push (@newTldPaths, $1 ) if ( m~^([^/]+)/$~ );
801
                push (@newTldPaths, $1 ) if ( m~^([^/]+)/$~ );
782
            }
802
            }
783
        }
803
        }
784
 
804
 
Line 791... Line 811...
791
            #   are not present in the New Import
811
            #   are not present in the New Import
792
            #
812
            #
793
            if ( $opt_mergePaths )
813
            if ( $opt_mergePaths )
794
            {
814
            {
795
                my $keep = 0;
815
                my $keep = 0;
-
 
816
                ##
-
 
817
                ##  Following removed because it did the wrong thing and I'm not too sure
-
 
818
                ##  under what conditions its needed.
-
 
819
                ##  It did the wrong thing when used with '++,XXXX/**'
-
 
820
                ##  Perhaps its only these that cause problems
-
 
821
 
-
 
822
                ##
796
                foreach ( @newTldPaths )
823
                ##foreach ( @newTldPaths )
-
 
824
                ##{
-
 
825
                ##    if ( $file =~ m~^$_/~ )
-
 
826
                ##    {
-
 
827
                ##        Verbose("Merge Retain(0): $file, $_");
-
 
828
                ##        $keep = 1;
-
 
829
                ##        last;
-
 
830
                ##    }
-
 
831
                ##}
-
 
832
 
-
 
833
                if ( $file =~ m~(^.*/)~ )
797
                {
834
                {
798
                    if ( $file =~ m~^$_/~ )
835
                    my $tpath = $1;
-
 
836
                    foreach ( keys %persistPaths)
799
                    {
837
                    {
-
 
838
                        if ( $file =~ m~^$_~ )
-
 
839
                        {
800
                        Verbose("Merge Retain: $file");
840
                            Verbose0("Merge Retain(1): $file");
801
                        $keep = 1;
841
                            $keep = 1;
802
                        last;
842
                            last;
-
 
843
                        }
803
                    }
844
                    }
804
                }
845
                }
805
 
846
 
806
                #
847
                #
807
                #   Examine $opt_mergPaths and process entries that look like
848
                #   Examine $opt_mergPaths and process entries that look like
808
                #       build/**  -> keep the directory and every think under it
849
                #       build/**  -> keep the directory and every think under it
-
 
850
                #       build/*   -> Persist directory. Keep dir tree if not
-
 
851
                #                    being imported, otherwise delete.
809
                #
852
                #
810
                foreach ( split(',', $opt_mergePaths) )
853
                foreach ( split(',', $opt_mergePaths) )
811
                {
854
                {
812
                    if ( m~(.+/)\*\*$~ )
855
                    if ( m~(.+/)\*\*$~ )
813
                    {
856
                    {
814
                        my $base = $1;
857
                        my $base = $1;
815
                        if ( $file =~ m~^$base~ )
858
                        if ( $file =~ m~^$base~ )
816
                        {
859
                        {
817
                            Verbose("Merge Retain: $file");
860
                            Verbose0("Merge Retain(2): $file");
818
                            $keep = 1;
861
                            $keep = 1;
819
                            last;
862
                            last;
820
                        }
863
                        }
821
                    }
864
                    }
822
                }
865
                }
823
                
866
                
824
                next if ($keep);
867
                next if ($keep);
825
            }
868
            }
826
 
869
 
827
            Verbose ("Removing $file");
870
            Verbose0("Removing $file");
828
            $filesDeleted++ unless ( $file =~ m~/$~ );
871
            $filesDeleted++ unless ( $file =~ m~/$~ );
829
            $dirsDeleted++ if ( $file =~ m~/$~ );
872
            $dirsDeleted++ if ( $file =~ m~/$~ );
830
            unlink "$opt_workdir/$file";
873
            unlink "$opt_workdir/$file";
831
            push @processedFiles, $file;
874
            push @processedFiles, $file;
832
        }
875
        }
Line 896... Line 939...
896
                    {
939
                    {
897
                        $discard = 0;
940
                        $discard = 0;
898
                        last;
941
                        last;
899
                    }
942
                    }
900
                }
943
                }
901
                Verbose("Not Importing: $file") if ( $discard ) ;
944
                Verbose0("Not Importing: $file") if ( $discard ) ;
902
                next if ( $discard );
945
                next if ( $discard );
903
            }
946
            }
904
 
947
 
905
            my $src = "$opt_dir/$file";
948
            my $src = "$opt_dir/$file";
906
            my $target = "$opt_workdir/$file";
949
            my $target = "$opt_workdir/$file";
Line 908... Line 951...
908
            $dirsAdded++ if ( $file =~ m~/$~ );
951
            $dirsAdded++ if ( $file =~ m~/$~ );
909
            push @processedFiles, $file;
952
            push @processedFiles, $file;
910
 
953
 
911
            if ( -d $src )
954
            if ( -d $src )
912
            {
955
            {
913
                Verbose ("Adding directory: $file");
956
                Verbose0("Adding directory: $file");
914
                mkdir ( $target ) unless (-d $target);
957
                mkdir ( $target ) unless (-d $target);
915
            }
958
            }
916
            else
959
            else
917
            {
960
            {
918
 
961
 
919
                my $path = dirname ( $target);
962
                my $path = dirname ( $target);
920
                mkdir ( $path ) unless (-d $path);
963
                mkdir ( $path ) unless (-d $path);
921
 
964
 
922
                Verbose ("Adding $file");
965
                Verbose0("Adding $file");
923
                unless (File::Copy::copy( $src, $target ))
966
                unless (File::Copy::copy( $src, $target ))
924
                {
967
                {
925
                    Error("Failed to transfer file [$file]: $!");
968
                    Error("Failed to transfer file [$file]: $!");
926
                }
969
                }
927
            }
970
            }