Git/Get-GitRepoBasePath.ps1

function Get-GitRepoBasePath
{
    Param(
        [Parameter(Mandatory=$true)]
        [string]$RepoPath
    )
    
    #attempt to read the extension config file first
    $ExtensionConfigPath = Join-Path (Join-Path $RepoPath 'Extension') 'extension.xml'        

    if (Test-Path $ExtensionConfigPath)
    {
        [xml]$ExtensionConfig = Get-Content $ExtensionConfigPath
        if ($ExtensionConfig.SelectNodes('extension/base').Count -eq 1)
        {            
            $ExtensionConfig.SelectSingleNode('extension/base').InnerText
            return
        }
    }


    [int]$VersionNo = 0

    $RepoLeaf = Split-Path $RepoPath -Leaf

    if ($RepoLeaf.Length -ge 4) {
        if ([Int]::TryParse($RepoLeaf.Substring($RepoLeaf.Length - 4),[ref]$VersionNo))
        {
            ('$/NAV - Base Versions/{0}/RTM' -f $VersionNo)
        }
    }
}    

Export-ModuleMember -Function Get-GitRepoBasePath