Subversion Repositories DevTools

Rev

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

Rev 7236 Rev 7272
Line 724... Line 724...
724
#                   Only allow a 'copy' if the local workspace is
724
#                   Only allow a 'copy' if the local workspace is
725
#                   up to date with respect with the repo. It possible
725
#                   up to date with respect with the repo. It possible
726
#                   to do a 'commit' and then a 'copy' (tag) and have
726
#                   to do a 'commit' and then a 'copy' (tag) and have
727
#                   unexpected results as the workspace has not been
727
#                   unexpected results as the workspace has not been
728
#                   updated. This is a trap.
728
#                   updated. This is a trap.
-
 
729
#                   
-
 
730
#                   Only allow a 'copy' if the local workspace NOT a
-
 
731
#                   mixed workspace. A mixed workspace will have 
-
 
732
#                   unexpected results - files will be added/deleted/moved
-
 
733
#                   on 'tags' but not appear on the source branch. 
-
 
734
#                   This is a trap.
729
#
735
#
730
#
736
#
731
# Inputs          : $self        - Instance data
737
# Inputs          : $self               - Instance data
732
#                   A hash of named arguments
738
#                   A hash of named arguments
733
#                       path     - Path to local workspace
739
#                       path            - Path to local workspace
734
#                       target   - Location within the repository to copy to
740
#                       target          - Location within the repository to copy to
735
#                       comment  - Commit comment
741
#                       comment         - Commit comment
736
#                       modified - Array of files that are allowed to
742
#                       modified        - Array of files that are allowed to
737
#                                  be modified in the workspace.
743
#                                         be modified in the workspace.
738
#                       noswitch        - True: Don't switch to the new URL
744
#                       noswitch        - True: Don't switch to the new URL
739
#                       replace         - True: Delete existing tag if present
745
#                       replace         - True: Delete existing tag if present
740
#                       allowLocalMods  - True: Allow complex tagging
746
#                       allowLocalMods  - True: Allow complex tagging
741
#                       noupdatecheck   - True: Do not check that the WS is up to date
747
#                       noupdatecheck   - True: Do not check that the WS is up to date
742
#
748
#
Line 766... Line 772...
766
    #   Cannot have a 'peg'
772
    #   Cannot have a 'peg'
767
    #
773
    #
768
    Error ("SvnCopyWs: Target contains a Peg: ($1)", $target)
774
    Error ("SvnCopyWs: Target contains a Peg: ($1)", $target)
769
        if ( $target =~ m~(@\d+)\s*$~ );
775
        if ( $target =~ m~(@\d+)\s*$~ );
770
 
776
 
-
 
777
 
-
 
778
    #
-
 
779
    #   Ensure the workspace is not Mixed
-
 
780
    #   Perform an svn info -R and ensure that all files are at the same 'Revision'
-
 
781
    #       Note: can't use the --show-item option as not all versions of svn support this
-
 
782
    #   
-
 
783
    unless ( $opt{allowLocalMods} )
-
 
784
    {
-
 
785
        Verbose "Ensure workspace does not contain Mixed Revisions";
-
 
786
        $rv = $self->SvnCmd ( 'info', '-R' , $path
-
 
787
                            , { 'process' => \&ProcessMixedRev,
-
 
788
                                'nosavedata' => 1,
-
 
789
                                'printdata' => 0,
-
 
790
                                 }
-
 
791
                            );
-
 
792
        if ($rv)
-
 
793
        {
-
 
794
            my @err1 = @{$self->{ERROR_LIST}};
-
 
795
            Error ("SvnCopyWs: Check Mixed Versions", @err1);
-
 
796
        }
-
 
797
 
-
 
798
        if ($self->{'MixedRev'} )
-
 
799
        {
-
 
800
            Error ('SvnCopyWs: The Workspace contains mixed revision.',
-
 
801
                   'This will result in file changes being made on the \'tags\' path and not',
-
 
802
                   'correctly represented on the branch/trunk.',
-
 
803
                   'Update the workspace and try again.');
-
 
804
        }
-
 
805
    }
-
 
806
 
771
    #
807
    #
772
    #   Ensure the Workspace is up to date
808
    #   Ensure the Workspace is up to date
773
    #       Determine the state of the Repo and the Workspace
809
    #       Determine the state of the Repo and the Workspace
774
    #
810
    #
775
    unless ( $opt{noupdatecheck} )
811
    unless ( $opt{noupdatecheck} )
Line 822... Line 858...
822
                        , $target
858
                        , $target
823
                        , '--parents'
859
                        , '--parents'
824
                        , '-m', SvnComment( $opt{'comment'}, 'Created by SvnCopyWs' ),
860
                        , '-m', SvnComment( $opt{'comment'}, 'Created by SvnCopyWs' ),
825
                        , { 'process' => \&ProcessRevNo,
861
                        , { 'process' => \&ProcessRevNo,
826
                            'credentials' => 1,
862
                            'credentials' => 1,
827
                            'printdata' => 1,
863
                            'printdata' => 0,
828
                             }
864
                             }
829
                        );
865
                        );
830
    if ($rv)
866
    if ($rv)
831
    {
867
    {
832
        #
868
        #
Line 867... Line 903...
867
    #Message ("Tag is: " . $self->{RMREF} );
903
    #Message ("Tag is: " . $self->{RMREF} );
868
    return $self->{RMREF} ;
904
    return $self->{RMREF} ;
869
}
905
}
870
 
906
 
871
#-------------------------------------------------------------------------------
907
#-------------------------------------------------------------------------------
-
 
908
# Function        : ProcessMixedRev 
-
 
909
#
-
 
910
# Description     : Process svn output looking for mixed revisions in the workspace
-
 
911
#                   Just interested in the 'Revision:' of each file
-
 
912
#                   Really just want to know if there is more than one revision
-
 
913
#                   workspace.
-
 
914
#
-
 
915
# Inputs          : $self           - Class Data
-
 
916
#                   $line           - Input data to parse
-
 
917
#
-
 
918
# Returns         : 0 - Do not terminate input command
-
 
919
#
-
 
920
sub ProcessMixedRev
-
 
921
{
-
 
922
    my ($self, $line ) = @_;
-
 
923
    Message ( $line ) if $self->{PRINTDATA};
-
 
924
 
-
 
925
    $line =~ s~\s+$~~;
-
 
926
    return 0 unless ( $line );
-
 
927
    return 0 unless ($line =~ m~^Revision:\s*(\d+)~);
-
 
928
    my $revNo = $1;
-
 
929
 
-
 
930
     my $revNoStash =  \%{$self->{revNoStash}};
-
 
931
     $revNoStash->{$revNo}++;
-
 
932
 
-
 
933
     if (scalar keys %{$revNoStash} > 1 ) {
-
 
934
         $self->{'MixedRev'} = 1;
-
 
935
         return 1;
-
 
936
     }
-
 
937
    return 0;
-
 
938
}
-
 
939
 
-
 
940
 
-
 
941
#-------------------------------------------------------------------------------
872
# Function        : SvnWsModified
942
# Function        : SvnWsModified
873
#
943
#
874
# Description     : Test a Workspace for modified files
944
# Description     : Test a Workspace for modified files
875
#                   Allow some files to be modified
945
#                   Allow some files to be modified
876
#
946
#