nsmcp::codeUpstreamMapping

 nsmcp::codeUpstreamMapping

Defined in

Partial Call Graph (max 5 caller/called nodes):
Class ::nsmcp::CodeUpstreamTool Class ::nsmcp::CodeUpstreamTool (public) nsmcp::codeUpstreamMapping nsmcp::codeUpstreamMapping Class ::nsmcp::CodeUpstreamTool->nsmcp::codeUpstreamMapping compare compare compare->nsmcp::codeUpstreamMapping instproc instproc instproc->nsmcp::codeUpstreamMapping nsmcp::CodeUpstreamTool nsmcp::CodeUpstreamTool nsmcp::CodeUpstreamTool->nsmcp::codeUpstreamMapping nsmcp::codeUpstreamPath nsmcp::codeUpstreamPath nsmcp::codeUpstreamMapping->nsmcp::codeUpstreamPath nsmcp::codeUpstreamRef nsmcp::codeUpstreamRef nsmcp::codeUpstreamMapping->nsmcp::codeUpstreamRef

Testcases:
No testcase defined.
Source code:
    codeUpstreamPath $path
    set selected {}
    set longest -1
    foreach mapping $mappings {
        foreach key {localPrefix repository upstreamPrefix ref} {
            if {![dict exists $mapping $key]} {
                error "invalid-upstream-mapping"
            }
        }
        set prefix [codeUpstreamPath [dict get $mapping localPrefix]]
        if {[string index $prefix end] ne "/"} {
            error "upstream-local-prefix-must-end-in-slash"
        }
        set repo [dict get $mapping repository]
        if {![regexp {^[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*$} $repo]} {
            error "invalid-upstream-repository"
        }
        set remote [codeUpstreamPath [dict get $mapping upstreamPrefix] true]
        if {$remote ne {} && [string index $remote end] ne "/"} {
            error "upstream-prefix-must-end-in-slash"
        }
        codeUpstreamRef [dict get $mapping ref]
        if {[dict exists $mapping baselineRef] && [dict get $mapping baselineRef] ne {}} {
            codeUpstreamRef [dict get $mapping baselineRef]
        }
        if {[string first $prefix $path]==0 && [string length $prefix]>$longest} {
            set selected $mapping
            set longest [string length $prefix]
            dict set selected path $remote[string range $path $longest end]
        }
    }
    if {$selected eq {}} {
        error "upstream-mapping-not-configured"
    }
    codeUpstreamPath [dict get $selected path]
    return $selected
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: