简体   繁体   English

用于更新SVN文件夹的命令行

[英]Command line to update SVN folders

I have tried several things so far, but I haven't had much luck yet. 到目前为止,我已经尝试了几件事,但我还没有多少运气。 I'm attempting to have a command line or PowerShell script that I can run once a day to make sure my numerous checked-out projects are up to date. 我正在尝试使用命令行或PowerShell脚本,我可以每天运行一次,以确保我的众多检出项目是最新的。

I know I would be looping through the directory folders inside my workspace, but when setting the variables I haven't had any luck as it will error out. 我知道我会循环遍历工作区内的目录文件夹,但是在设置变量时我没有运气,因为它会出错。 I am using TortoiseSVN , and Windows Vista . 我正在使用TortoiseSVNWindows Vista

Here is what I have so far: 这是我到目前为止:

echo == Initiating system instance variables...
echo. -- Setting the variables...

:: Here you need to make some changes to suit your system.
set SOURCE=C:\workspace\Project
set SVN=C:\Program Files\TortoiseSVN\bin
:: Unless you want to modify the script, this is enough.

echo. %SOURCE%
echo. %SVN%
echo. ++ Done setting variables.
echo.
echo == Updating source from SVN
echo. -- Running update...
"%SVN%\TortoiseProc.exe" /command:update /path:"%SOURCE%" /closeonend:2
echo. ++ Done.

echo. -- Cleaning up...
set SOURCE=
set SVN=
echo. ++ Done.

@echo off

It might be easier in PowerShell: 在PowerShell中可能更容易:

Set-Alias tsvn 'C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe'
dir C:\workspace | %{ tsvn /command:update /path:"$($_.FullName)" /closeonend:2 }

Or if you want to specify certain project directories: 或者,如果要指定某些项目目录:

cd C:\workspace
$projects = 'Proj 1','Proj 2','Proj 3'
$projects | %{ tsvn /command:update /path:"$_" /closeonend:2 }

PowerShell scripts have a ps1 extension. PowerShell脚本具有ps1扩展名。 You might also have to update the execution policy to allow scripts to run: 您可能还必须更新执行策略以允许脚本运行:

Set-ExecutionPolicy RemoteSigned

Just use the SVN command line itself: 只需使用SVN命令行本身:

pushd "%SOURCE%"
svn update
popd

You can get the Subversion tools for Windows at http://subversion.tigris.org/getting.html#windows . 您可以在http://subversion.tigris.org/getting.html#windows上获取适用于Windows的Subversion工具。 Install them side by side with TortoiseSVN. 使用TortoiseSVN并排安装它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM