Subversion Repositories DevTools

Rev

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

Rev 2424 Rev 2616
Line 537... Line 537...
537
    my $opt_log = '';
537
    my $opt_log = '';
538
    my $opt_branch;
538
    my $opt_branch;
539
    my $opt_datafile;
539
    my $opt_datafile;
540
    my $opt_printfiles;
540
    my $opt_printfiles;
541
    my $opt_commit = 1;
541
    my $opt_commit = 1;
-
 
542
    my $opt_nodelete;
542
 
543
 
543
    #
544
    #
544
    #   Other globals
545
    #   Other globals
545
    #
546
    #
546
    my $url_label;
547
    my $url_label;
547
    my $url_branch;
548
    my $url_branch;
548
 
549
 
-
 
550
    my $filesBase = 0;                  # Files in Base workspace
-
 
551
    my $filesDeleted = 0;               # Files Deleted
-
 
552
    my $filesAdded = 0;                 # Files Added
-
 
553
    my $dirsDeleted = 0;                # Directories Deleted
-
 
554
    my $dirsAdded = 0;                  # Directories Added
-
 
555
    
-
 
556
 
549
    #
557
    #
550
    #   Configuration options
558
    #   Configuration options
551
    #
559
    #
552
    my $result = GetOptions (
560
    my $result = GetOptions (
553
                    'help:+'        => \$opt_help,
561
                    'help:+'        => \$opt_help,
Line 565... Line 573...
565
                    'author=s'      => \$opt_author,
573
                    'author=s'      => \$opt_author,
566
                    'date=s'        => \$opt_date,
574
                    'date=s'        => \$opt_date,
567
                    'log=s'         => \$opt_log,
575
                    'log=s'         => \$opt_log,
568
                    'datafile=s'    => \$opt_datafile,
576
                    'datafile=s'    => \$opt_datafile,
569
                    'commit!'       => \$opt_commit,
577
                    'commit!'       => \$opt_commit,
-
 
578
                    'nodelete=s'    => \$opt_nodelete,
570
 
579
 
571
                    #
580
                    #
572
                    #   Update documentation at the end of the file
581
                    #   Update documentation at the end of the file
573
                    #
582
                    #
574
                    ) || Error ("Invalid command line" );
583
                    ) || Error ("Invalid command line" );
Line 683... Line 692...
683
 
692
 
684
    #
693
    #
685
    #   Scan for a source file
694
    #   Scan for a source file
686
    #   Trying to detect empty views
695
    #   Trying to detect empty views
687
    #   Look for file, not directory
696
    #   Look for file, not directory
-
 
697
    #       Keep a count for reporting
688
    #
698
    #
689
    {
699
    {
-
 
700
        foreach ( @ws )
-
 
701
        {
-
 
702
            $filesBase++ unless ( m~/$~ );
-
 
703
        }
-
 
704
 
690
        my $fileFound = 0;
705
        my $fileFound = 0;
691
        foreach ( @dir )
706
        foreach ( @dir )
692
        {
707
        {
693
            next if ( m~/$~ );
708
            next if ( m~/$~ );
694
            $fileFound++;
709
            $fileFound = 1;
695
            last;
710
            last;
696
        }
711
        }
697
 
712
 
698
        unless ( $fileFound )
713
        unless ( $fileFound )
699
        {
714
        {
Line 739... Line 754...
739
    #
754
    #
740
    #   Remove files
755
    #   Remove files
741
    #   Sort in reverse. This will ensure that we process directory
756
    #   Sort in reverse. This will ensure that we process directory
742
    #   contents before directories
757
    #   contents before directories
743
    #
758
    #
-
 
759
    
744
    my @rm_files = reverse sort keys %ws;
760
    my @rm_files = reverse sort keys %ws;
-
 
761
    my @noDelete = split(',', $opt_nodelete);
745
    if ( @rm_files )
762
    if ( @rm_files )
746
    {
763
    {
-
 
764
        my @processedFiles;
747
        foreach my $file ( @rm_files  )
765
        foreach my $file ( @rm_files  )
748
        {
766
        {
-
 
767
            #
-
 
768
            #   Detect items that are to be retained
-
 
769
            #
-
 
770
            if ( $opt_nodelete )
-
 
771
            {
-
 
772
                my $keep = 0;
-
 
773
                foreach ( @noDelete )
-
 
774
                {
-
 
775
                    if ( $file =~ m~(^|/)$_(/|$)~ )
-
 
776
                    {
-
 
777
#                        Verbose0("Not deleting: $file");
-
 
778
                        $keep = 1;
-
 
779
                        last;
-
 
780
                    }
-
 
781
                }
-
 
782
                next if ($keep);
-
 
783
            }
-
 
784
 
749
            Verbose ("Removing $file");
785
            Verbose ("Removing $file");
-
 
786
            $filesDeleted++ unless ( $file =~ m~/$~ );
-
 
787
            $dirsDeleted++ if ( $file =~ m~/$~ );
750
            unlink "$opt_workdir/$file";
788
            unlink "$opt_workdir/$file";
-
 
789
            push @processedFiles, $file;
751
        }
790
        }
-
 
791
        @rm_files = @processedFiles;
752
 
792
 
753
        #
793
        #
754
        #   Inform Subversion about the removed files
794
        #   Inform Subversion about the removed files
755
        #
795
        #
756
        my $base = 0;
796
        my $base = 0;
757
        my $num = $#rm_files;
797
        my $num = $#rm_files;
758
        Message ("Update the workspace: Removed " . ($num + 1) . " Files");
798
        Message ("Update the workspace: Removed $filesDeleted Files, $dirsDeleted directories");
759
 
799
 
760
        while ( $base <= $num )
800
        while ( $base <= $num )
761
        {
801
        {
762
            my $end = $base + 200;
802
            my $end = $base + 200;
763
            $end = $num if ( $end > $num );
803
            $end = $num if ( $end > $num );
Line 781... Line 821...
781
    {
821
    {
782
        foreach my $file ( @added  )
822
        foreach my $file ( @added  )
783
        {
823
        {
784
            my $src = "$opt_dir/$file";
824
            my $src = "$opt_dir/$file";
785
            my $target = "$opt_workdir/$file";
825
            my $target = "$opt_workdir/$file";
-
 
826
            $filesAdded++ unless ( $file =~ m~/$~ );
-
 
827
            $dirsAdded++ if ( $file =~ m~/$~ );
786
 
828
 
787
            if ( -d $src )
829
            if ( -d $src )
788
            {
830
            {
789
                Verbose ("Adding directory: $file");
831
                Verbose ("Adding directory: $file");
790
                mkdir ( $target ) unless (-d $target);
832
                mkdir ( $target ) unless (-d $target);
Line 809... Line 851...
809
        #   time.
851
        #   time.
810
        #
852
        #
811
 
853
 
812
        my $base = 0;
854
        my $base = 0;
813
        my $num = $#added;
855
        my $num = $#added;
814
        Message ("Update the workspace: Added " . (1 + $num) . " files");
856
        Message ("Update the workspace: Added $filesAdded Files, $dirsAdded directories");
815
 
857
 
816
        while ( $base <= $num )
858
        while ( $base <= $num )
817
        {
859
        {
818
            my $end = $base + 200;
860
            my $end = $base + 200;
819
            $end = $num if ( $end > $num );
861
            $end = $num if ( $end > $num );
Line 914... Line 956...
914
        $data->setProperty('Command'        , 'ImportPackage');
956
        $data->setProperty('Command'        , 'ImportPackage');
915
        $data->setProperty('Label'          , $opt_label);
957
        $data->setProperty('Label'          , $opt_label);
916
        $data->setProperty('subversion.url' , $svn->RmRef);
958
        $data->setProperty('subversion.url' , $svn->RmRef);
917
        $data->setProperty('subversion.tag' , $svn->SvnTag);
959
        $data->setProperty('subversion.tag' , $svn->SvnTag);
918
 
960
 
-
 
961
        $data->setProperty('files.base'     , $filesBase);
-
 
962
        $data->setProperty('files.removed'  , $filesDeleted);
-
 
963
        $data->setProperty('files.added'    , $filesAdded);
-
 
964
 
919
        $data->Dump('InfoFile') if ($opt_verbose);
965
        $data->Dump('InfoFile') if ($opt_verbose);
920
        $data->store( $opt_datafile );
966
        $data->store( $opt_datafile );
921
    }
967
    }
922
 
968
 
923
    $opr_done = 1;
969
    $opr_done = 1;
Line 1861... Line 1907...
1861
    -date=dateString        - Force date of changes
1907
    -date=dateString        - Force date of changes
1862
    -log=text               - Append text to the commit message
1908
    -log=text               - Append text to the commit message
1863
    -datafile=path          - Export tag data for automation
1909
    -datafile=path          - Export tag data for automation
1864
    -[no]commit             - Prevent chnages being commited. Default:Yes
1910
    -[no]commit             - Prevent chnages being commited. Default:Yes
1865
    -printfiles=n           - Control commit verbosity
1911
    -printfiles=n           - Control commit verbosity
-
 
1912
    -nodelete=dirList       - Comma separated list of directores to retain
1866
 
1913
 
1867
=head2 ARGUMENTS
1914
=head2 ARGUMENTS
1868
 
1915
 
1869
The command takes one argument: The URL of the desired package.
1916
The command takes one argument: The URL of the desired package.
1870
This may be be:
1917
This may be be:
Line 1985... Line 2032...
1985
This option controls commit verbosity. The default operation is to display
2032
This option controls commit verbosity. The default operation is to display
1986
the files added and removed during the commit.
2033
the files added and removed during the commit.
1987
 
2034
 
1988
Suitable numbers are: None, 0 (No Display) and 1 (Full Display).
2035
Suitable numbers are: None, 0 (No Display) and 1 (Full Display).
1989
 
2036
 
-
 
2037
=item -nodelete=dirList
-
 
2038
 
-
 
2039
This option specifies a Comma separated list of directores to be retained
-
 
2040
during the import process. This works as via the following mechanism:
-
 
2041
 
-
 
2042
If the named directory exists in the 'new' image it will replace that in the
-
 
2043
'initial' workspace.
-
 
2044
 
-
 
2045
If the named directory does not exist in the 'new' image, but does exist in the
-
 
2046
'initial' image then it will be retained in the 'final' image.
-
 
2047
 
1990
=back
2048
=back
1991
 
2049
 
1992
=head2 DESCRIPTION
2050
=head2 DESCRIPTION
1993
 
2051
 
1994
Import a new version of a package to the trunk of the package. The utility
2052
Import a new version of a package to the trunk of the package. The utility