|
2
|
| Serge van den Oever · 技术社区 · 17 年前 |
|
|
1
2
故事继续: 如果从cmd提示符执行tf命令,则一切都将按照前面的回答进行。如果在PowerShell命令提示符下执行此操作,则会得到以下结果: PS C:\> & tf.exe workfold c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk /login:macaw\serge,Trasimeno5 TF10125: The path 'c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk' must start with $/
我什么都试过了,但没有用。我甚至通过TFS对象模型进行了尝试,但这变得非常复杂。要获取本地文件夹的工作区,首先需要tfs服务器的名称。可能会迭代所有当前映射的工作区,并迭代其中定义的服务器(这可能是tf.exe所做的),以测试本地文件夹是否属于该工作区。 我最终提出了以下解决方案:
@echo off rem This is a kind of strange batch file, needed because execution of this command in PowerShell gives an error. rem This script retrieves TFS sourcecontrol information about a local folder using the following command: rem tf workfold /login:domain\user,password rem %1 is path to the tf.exe executable rem %2 is the local path rem %3 is the domain\user [optional, integrated security used if ommited] rem %4 is the password [optional, if %3 is not specified] rem Output is in format: rem =============================================================================== rem Workspace: Macaw.SolutionsFactory@VS-D-SVDOMOSS-1 (Serge) rem Server : tfs.macaw.nl rem $/Macaw.SolutionsFactory/FactoryIdeTools/trunk: C:\Projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk if [%3]==[] goto integratedsecurity %1 workfold "%2" /login:%3,%4 goto end :integratedsecurity %1 workfold "%2" :end 我从PowerShell中调用此批处理脚本。根据我要分析的结果:
$tfsProductInfo = & "ExecTfWorkprodCommand.bat "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" "c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk" domain\user password
if ($tfsProductInfo -eq $null)
{
Write-Output "Can't determine Tfs source control information on local folder"
}
else
{
$tfsserver = [Regex]::Split($tfsProductInfo[2], ": ")[1].Trim()
$serverpath = [Regex]::Split($tfsProductInfo[3], ": ")[0].Trim()
$localpath = [Regex]::Split($tfsProductInfo[3], ": ")[1].Trim()
Write-Output "Server : $tfsserver"
Write-Output "Server path: $serverpath"
Write-Output "Local path : $localpath"
}
|
|
|
2
1
好的,我自己找到了答案。首先:有一个wat来指定tf.exe命令行工具的凭据。使用/登录:域\用户,密码。 现在如果我执行: tf workfold c:\projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk /login:domain\user,password 我得到以下结果: =========================================================================================================================================== Workspace: Macaw.SolutionsFactory@VS-D-SVDOMOSS-1 (Serge) Server : tfs.mycompany.nl $/Macaw.SolutionsFactory/FactoryIdeTools/trunk: C:\Projects\Macaw.SolutionsFactory\FactoryIdeTools\trunk 这就是我需要的所有信息! |
|
|
Jordan · 使用git初始化GitHub存储库的版本控制 2 年前 |
|
|
Viermusketiere · 嵌入式系统开发中如何进行版本控制 2 年前 |
|
|
Luke · 如何使用subversion管理生产/测试/开发配置信息? 17 年前 |
|
|
Carson Myers · 尝试开始使用git 17 年前 |
|
|
betitall · 如何对跨项目共享的资源进行版本控制 17 年前 |