Ticket #54697: patch-action_history.diff

File patch-action_history.diff, 2.5 KB (added by RJVB (René Bertin), 7 years ago)
  • src/port/port.tcl

    diff --git a/src/port/port.tcl b/src/port/port.tcl
    index 3320fba6..3d3cea63 100644
    a b proc action_portcmds { action portlist opts } { 
    40304057                        ui_error [format "No homepage for %s" $portname]
    40314058                    }
    40324059                }
     4060                history {
     4061                    set tmpdir [pwd]
     4062                    if {[file exists "/tmp"]} {set tmpdir "/tmp"}
     4063                    catch {set tmpdir $::env(TMPDIR)}
     4064                    set tmpfname [file join $tmpdir [join [list $portname "-history-" [pid] ".log"] ""]]
     4065                    puts "Commit history for port:$portname ($portfile):\n"
     4066                    if {[macports::ui_isset ports_verbose]} {
     4067                        # include diffs
     4068                        set opt "--color=always -p"
     4069                    } else {
     4070                        # include just a summary of the changes
     4071                        set opt "--no-color --summary"
     4072                    }
     4073                    if {[catch {system -W $portdir \
     4074                        "git log --decorate=full --source --full-diff $opt . > $tmpfname"} \
     4075                        result]} {
     4076                        ui_debug $::errorInfo
     4077                        file delete -force $tmpfname
     4078                        break_softcontinue "unable to invoke git: $result" 1 status
     4079                    }
     4080                    if {[file exists $tmpfname]} {
     4081                        if {[catch {set fp [open $tmpfname r]} result]} {
     4082                            break_softcontinue "Could not open file $tmpfname: $result" 1 status
     4083                        }
     4084                        set history [read $fp]
     4085                        set history [split $history "\n"]
     4086                        foreach line $history {
     4087                            puts "$line"
     4088                        }
     4089                        close $fp
     4090                        file delete -force $tmpfname
     4091                    }
     4092                }
    40334093            }
    40344094        } else {
    40354095            break_softcontinue "Could not read $portfile" 1 status
    array set action_array [list \ 
    42794340    file        [list action_portcmds       [ACTION_ARGS_PORTS]] \
    42804341    logfile     [list action_portcmds       [ACTION_ARGS_PORTS]] \
    42814342    gohome      [list action_portcmds       [ACTION_ARGS_PORTS]] \
     4343    history     [list action_portcmds       [ACTION_ARGS_PORTS]] \
    42824344    \
    42834345    fetch       [list action_target         [ACTION_ARGS_PORTS]] \
    42844346    checksum    [list action_target         [ACTION_ARGS_PORTS]] \