root/trunk/prefix-overlay/app-portage/gentoolkit-dev/files/gentoolkit-dev-0.2.6.1-svn-echangelog.patch

Revision 2291, 7.1 kB (checked in by grobian, 2 years ago)

Add svn support for echangelog.

  • src/echangelog/echangelog

    old new  
    4747} 
    4848 
    4949# Figure out what has changed around here 
    50 open C, 'cvs -fn up 2>&1 |' or die "Can't run cvs -fn up: $!\n"; 
    51 while (<C>) { 
    52     if (/^C (\S+)/) { 
    53         push @conflicts, $1;  
    54         next; 
    55     } elsif (/^\? (\S+)/) { 
    56         push @unknown, $1; 
    57         $actions{$1} = '+'; 
    58         next; 
    59     } elsif (/^([ARM]) (\S+)/) { 
    60         push @files, $2; 
    61         ($actions{$2} = $1) =~ tr/ARM/+-/d; 
     50if (-d 'CVS') { 
     51    open C, 'cvs -fn up 2>&1 |' or die "Can't run cvs -fn up: $!\n"; 
     52    while (<C>) { 
     53        if (/^C (\S+)/) { 
     54            push @conflicts, $1;  
     55            next; 
     56        } elsif (/^\? (\S+)/) { 
     57            push @unknown, $1; 
     58            $actions{$1} = '+'; 
     59            next; 
     60        } elsif (/^([ARM]) (\S+)/) { 
     61            push @files, $2; 
     62            ($actions{$2} = $1) =~ tr/ARM/+-/d; 
     63        } 
     64    } 
     65} elsif (-d '.svn') { 
     66    open C, 'svn status 2>&1 |' or die "Can't run svn status: $!\n"; 
     67    while (<C>) { 
     68        if (/^ ?C +(\S+)/) { 
     69            push @conflicts, $1;  
     70            next; 
     71        } elsif (/^\? +(\S+)/) { 
     72            push @unknown, $1; 
     73            $actions{$1} = '+'; 
     74            next; 
     75        } elsif (/^([ADRM])[ \+]+(\S+)/) { 
     76            push @files, $2; 
     77            ($actions{$2} = $1) =~ tr/ADRM/+-/d; 
     78        } 
    6279    } 
    6380} 
    6481 
     
    84101# out above) 
    85102if (@unknown) { 
    86103    print STDERR <<EOT; 
    87 Cvs reports the following unknown files.  Please use "cvs add" before 
     104Cvs/svn reports the following unknown files.  Please use "cvs/svn add" before 
    88105running echangelog, or remove the files in question. 
    89106EOT 
    90107    print STDERR map "? $_\n", @unknown; 
     
    180197@ebuilds = grep /\.ebuild$/, @files; 
    181198@files = grep !/\.ebuild$/, @files; 
    182199if (@ebuilds) { 
    183     open C, "cvs -f diff -U0 @ebuilds 2>&1 |" or die "Can't run cvs diff: $!\n"; 
    184     $_ = <C>; 
    185     while (defined $_) { 
    186         if (/^cvs diff: (([^\/]*?)\.ebuild) was removed/) {  
    187             push @files, $1; 
    188         } 
    189         elsif (/^Index: (([^\/]*?)\.ebuild)\s*$/) {  
    190             my ($f, $v) = ($1, $2); 
    191             # check if more than just copyright date changed. 
    192             # skip some lines 
    193             $_ = <C>;   # ==================================== 
    194             $_ = <C>;   # RCS file: ... 
    195             $_ = <C>;   # retrieving revision 
    196             $_ = <C>;   # diff -u ... 
    197             $_ = <C>;   # --- vim-6.2-r6.ebuild 
    198             $_ = <C>;   # +++ vim-6.2-r6.ebuild 
    199             while (<C>) { 
    200                 last if /^[A-Za-z]/; 
    201                 if (/^[-+](?!# Copyright)/) { 
    202                     push @files, $f; 
    203                     last; 
     200    if (-d 'CVS') { 
     201        open C, "cvs -f diff -U0 @ebuilds 2>&1 |" or die "Can't run cvs diff: $!\n"; 
     202        $_ = <C>; 
     203        while (defined $_) { 
     204            if (/^cvs diff: (([^\/]*?)\.ebuild) was removed/) {  
     205                push @files, $1; 
     206            } 
     207            elsif (/^Index: (([^\/]*?)\.ebuild)\s*$/) {  
     208                my ($f, $v) = ($1, $2); 
     209                # check if more than just copyright date changed. 
     210                # skip some lines 
     211                $_ = <C>;       # ==================================== 
     212                $_ = <C>;       # RCS file: ... 
     213                $_ = <C>;       # retrieving revision 
     214                $_ = <C>;       # diff -u ... 
     215                $_ = <C>;       # --- vim-6.2-r6.ebuild 
     216                $_ = <C>;       # +++ vim-6.2-r6.ebuild 
     217                while (<C>) { 
     218                    last if /^[A-Za-z]/; 
     219                    if (/^[-+](?!# Copyright)/) { 
     220                        push @files, $f; 
     221                        last; 
     222                    } 
    204223                } 
     224                # at this point we've either added $f to @files or not, 
     225                # and we have the next line in $_ for processing 
     226                next; 
    205227            } 
    206             # at this point we've either added $f to @files or not, 
    207             # and we have the next line in $_ for processing 
    208             next; 
    209         } 
    210         elsif (/^cvs.*?: (([^\/]*?)\.ebuild) is a new entry/) {  
    211             push @files, $1; 
    212             push @new_versions, $2;  # new ebuild, will create a new entry 
     228            elsif (/^cvs.*?: (([^\/]*?)\.ebuild) is a new entry/) {  
     229                push @files, $1; 
     230                push @new_versions, $2;  # new ebuild, will create a new entry 
     231            } 
     232            # other cvs output is ignored 
     233            $_ = <C>; 
    213234        } 
    214         # other cvs output is ignored 
     235    } elsif (-d '.svn') { 
     236        open C, "svn status @ebuilds 2>&1 |" or die "Can't run svn status: $!\n"; 
    215237        $_ = <C>; 
     238        while (defined $_) { 
     239            if (/^D[ ]+(([^\/]*?)\.ebuild)/) { 
     240                push @files, $1; 
     241            } elsif (/^A[ \+]+(([^\/]*?)\.ebuild)/) { 
     242                push @files, $1; 
     243                push @new_versions, $2;  # new ebuild, will create a new entry 
     244            } elsif (/^[RM][ \+]+(([^\/]*?)\.ebuild)/) { 
     245                open D, "svn diff $1 2>&1 |" or die "Can't run svn diff: $!\n"; 
     246                my ($f, $v) = ($1, $2); 
     247                $_ = <D>; 
     248                while (defined $_) { 
     249                    # check if more than just copyright date changed. 
     250                    # skip some lines 
     251                    $_ = <D>;   # ==================================== 
     252                    $_ = <D>;   # --- vim-6.2-r6.ebuild 
     253                    $_ = <D>;   # +++ vim-6.2-r6.ebuild 
     254                    while (<D>) { 
     255                        last if /^[A-Za-z]/; 
     256                        if (/^[-+](?!# Copyright)/) { 
     257                            push @files, $f; 
     258                            last; 
     259                        } 
     260                    } 
     261                    # at this point we've either added $f to @files or not, 
     262                    # and we have the next line in $_ for processing 
     263                    next; 
     264                } 
     265                close D; 
     266            } 
     267            # other svn output is ignored 
     268            $_ = <C>; 
     269        } 
    216270    } 
    217271} 
    218272close C; 
     
    230283    print STDERR "**\n"; 
    231284    print STDERR "** NOTE: No non-trivial changed files found.  Normally echangelog\n"; 
    232285    print STDERR "** should be run after all affected files have been added and/or\n"; 
    233     print STDERR "** modified.  Did you forget to cvs add?\n"; 
     286    print STDERR "** modified.  Did you forget to cvs/svn add?\n"; 
    234287    print STDERR "**\n"; 
    235288    @files = sort sortfunc @trivial; 
    236289    @files = qw/ChangeLog/ unless @files;  # last resort to put something in the list 
     
    360413 
    361414# Okay, now we have a starter ChangeLog to work with. 
    362415# The text will be added just like with any other ChangeLog below.   
    363 # Add the new ChangeLog to cvs before continuing. 
    364 if (open F, "CVS/Entries") { 
    365     system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>); 
     416# Add the new ChangeLog to cvs/svn before continuing. 
     417if (-d 'CVS') { 
     418    if (open F, "CVS/Entries") { 
     419        system("cvs -f add ChangeLog") unless (scalar grep /^\/ChangeLog\//, <F>); 
     420    } 
     421} elsif (-d '.svn') { 
     422    if (open F, ".svn/entries") { 
     423        system("svn add ChangeLog") unless (scalar grep /^ChangeLog$/, <F>); 
     424    } 
    366425} 
    367426 
    368427# vim:sw=4 ts=8 expandtab 
Note: See TracBrowser for help on using the browser.