svn - 自动更新Powershell脚本

标签 svn powershell powershell-2.0

自更新(从 SVN)Powershell 脚本的最佳方式是什么?

它应该能够启动一个新进程,然后调用SVN update $script; './$script',在确保当前进程已结束后。

if ((svn st -u --quiet $script) -match "\*"){
     $scriptToRun = 'SVN update $script; "./$script"'
     ##start new process that will end this process and execute $scriptToRun
}

最佳答案

我认为这可以解决问题,即使有点天真。您有两个脚本 - StartApp.ps1,它们对更新进行任何必要的检查。运行后,然后链接 MainApp.ps1 这是应用程序本身,这就是要更新的内容。

StartApp.ps1 - 启动应用程序,但也会进行更新检查:

# Bootstrap app
#
# Check for updates here

if(some_check_to_determine_if_update_required)
{
    # Execute whatever external source control commands required but wait until 
    # done:
    Start-Process -Wait -FilePath "<path_to_svn>" -ArgumentList <args_you_need>
}

# Launch the (now possibly updated) app
.\MainApp.ps1

关于svn - 自动更新Powershell脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5637362/

相关文章:

xml - 如何在Powershell中从哈希表值附加xml

powershell - 计算Active Directory用户

powershell - 如何从命令行运行 Powershell 脚本并将目录作为参数传递

svn - svn move 命令是否也移动目录中的文件?

powershell - 如何自动保存 PowerShell session

powershell - 使用随机数据创建文件的最快方法

powershell - 函数输出类型

svn - 通过多次合并跟踪 SVN 更改

svn - 你会从 cvs 迁移到 svn 还是直接迁移到 git 或 hg?

svn - 为什么在将分支合并到主干然后将其合并回分支时会发生冲突?