Version 11 of COMPANY: AccuRev, Inc.

Updated 2006-11-06 17:49:59

AccuRev publishes the following package:

 What: AccuRev
 Where: http://www.accurev.com/
 Description: Commercial Source Code Management (SCM) tool.
        Has integrated TkDiff.  A Tk GUI interface is being
        developed.  Comes with an unlimited time 2 user license,
        and with support and more licenses available for purchase.
        Currently at v2.5.
 Updated: 08/1999
 Contact: mailto:[email protected]

The maintenance of tkdiff was picked up by this company when the original author was unable to continue maintenance - we applaud such actions.

See tkdiff for more details.


I started using accurev when I moved to my new job, and I found that I would often forget which streams were backing my current workspace. There isn't an accurev command line option for this, so I wrote a tcl script. I decided to make a package for accurev first, then include it. The code is sloppy and thrown together in a quick fit of annoynce so I'd expect anyone picking it up to improve it. When I do, I'll change it here. I'd rather do something that didn't have me calling out to exec everytime I recursed.

First, parents:

 #!/opt/ActiveTcl/bin/tclsh
 # parents

 package require tcl_acrev

 set stream [lindex $argv 0]

 if {($stream != {}) || ![catch {set stream [tcl_acrev::get_cwd_wspace]}]} {
     puts $stream
     if {[catch {tcl_acrev::get_ancestry $stream} ec]} {
         puts "help, I don't know how to find your parents: $ec"
     }
 } else {
     puts "help, I don't know how to find your parents $stream"
 }

Here is the package. again, sloppy.

 package provide tcl_acrev 1.0

 namespace eval tcl_acrev {}

 proc tcl_acrev::acupdate {} {
    if {[catch {exec accurev update} result]} {
        error $result
    }
    puts $result
 }

 proc tcl_acrev::acstat {{flag n}} {
    if {[catch {exec accurev stat -$flag} result]} {
        error $result
    }
    return $result
 }

 proc tcl_acrev::get_statted_files {{flag n}} {
    set stat_result [split [tcl_acrev::acstat $flag] \n]
    set file_list {}

    foreach line $stat_result {
        foreach {path stream version state} $line {
            lappend file_list $path
        }
    }
    return $file_list
 }


 proc tcl_acrev::updatepath {path} {
    if {![file isdirectory $path]} {
        error "$path is not a directory"
    }
    puts "updating $path"
    set cwd [pwd]
    cd $path
    set fail [catch {acupdate} ec]
    cd $cwd
    if {$fail} {
        puts "couldn't update $path: $ec"
    }
 }

 proc tcl_acrev::show_stream {stream} {

    if {![regexp {\d|\w|-} $stream]} {
        error "invalid arg ($stream)"
    }
    if {[catch {set accurev_show [exec accurev show -s $stream streams]} ec]} {
        error "$ec"
    }

    foreach {s basis depot number} [lindex [split $accurev_show \n] 1] {break}

    puts "$basis"

    return [list $basis $depot $number]
 }

 proc tcl_acrev::get_cwd_wspace {} {
    set wspace {}
    if {[catch {set info [exec accurev info]} ec]} {
        error "$ec"
    }
    regexp {ws/ref:\s+(\S+)} $info m wspace
    return $wspace
 }

 proc tcl_acrev::get_basis {stream} {
    return [lindex [show_stream $stream] 0]
 }

 proc tcl_acrev::get_depot {stream} {
    return [lindex [show_stream $stream] 1]
 }

 proc tcl_acrev::get_ancestry {stream} {
    if {$stream eq "--"} {
        return $stream
    }
    set basis [get_basis $stream]
    return [list $stream [get_ancestry $basis]]
 }

snichols

From the command line, this command will also give your basis or your backed Accurev stream in XML format:

 accurev show -fx -s <insert_your_workspace_name> streams.

Then you can use an XML parser such as tdom to parse the result instead of screen scraping. Or, if you want to know every single workspace that you have out there then run the command:

 accurev show -fx wspaces

Then parse the the Name XML attibute in each Element, and run the other command to get the basis. You could also walk all streams recursively until you get to the depot.

Category Company