简体   繁体   English

命令行SVN帮助检查工作副本是否是服务器中存在的副本的过期副本

[英]Command line SVN help to check the working copy is an outdated copy of the one present in the server

Hello I want to implement the following flow in my application.(as shown in the pseudocode) 您好,我想在我的应用程序中实现以下流程。(如伪代码所示)

LatestRevision = IsMyFileLatest(); LatestRevision = IsMyFileLatest(); // some method which should check the svn and compare the working copy of the file. //一些方法应检查svn并比较文件的工作副本。

if (! LatestRevision)  //this flag compares with the Head Revision
{
   //Display error message..The file is not the latest copy
}
else
{
  // Commit the file changes in the subversion server
  FileCommit();   //commits the file(whichever file im working to the server)     
}

For this i need help of the following svn commands executed in the command line. 为此,我需要在命令行中执行以下svn命令的帮助。

  1. to check whether the current file is the latest file ? 检查当前文件是否为最新文件?
  2. committing only those files which are modified..in a directory. 只提交那些在目录中被修改的文件。

Any help or pointers regarding the subversion command line is deeply appreciated. 非常感谢有关subversion命令行的任何帮助或指针。

Thanks and Best regards 谢谢和最好的问候

The VisualSVN site hosts a 'book' on Subversion, located here , which should give you a good starting point - though off the top of my head I'm not sure of the exact commands you'd need to use... VisualSVN站点在此处托管有关Subversion的“书”,该书应该为您提供一个很好的起点-尽管超出我的脑海,我不确定您需要使用的确切命令...

There is a chapter which is a reference for commands: 有一章是命令的参考:

SVN Reference . SVN参考

Explained there is svn info which may help you out well enough. 解释说有svn信息可能会帮助您。

EDIT: 编辑:

On the other hand, after reading your altered title, svn status may be what you're looking for? 另一方面,在阅读了更改的标题后, svn状态可能就是您想要的?

EDIT 2: 编辑2:

Ok, given that the programming language used in your question is not explicitly stated, and the fact it's such a common syntax that we could liken the guesswork to that of beating a dead horse, here's a little snippet in the universal (in the Windows world) VBScript... 好的,鉴于您的问题中使用的编程语言未明确说明,并且它是一种通用语法,因此我们可以将猜测比作击败一匹死马,这是通用语言的一些片段(在Windows世界中) )VBScript ...

Dim shell, svn
Set shell = CreateObject("WScript.Shell")
Set svn = shell.Exec("svn info [working_copy_path]")

WScript.Sleep 1000

Dim revision
Do While svn.StdOut.AtEndOfStream <> True 
    revision = svn.StdOut.ReadLine
    If left(revision, 8) = "Revision" Then
        Exit Do
End If
Loop

WScript.Echo revision

I'm far from proud of the Sleep mechanism utilised, but luckily I'm not the one with (much of) a responsibility here, so I'll leave generating a clean-cut approach to yourself and just put this out there as an example. 我不为所使用的Sleep机制感到骄傲,但是幸运的是,我并不是那种负责(大部分)的人,所以我将为您自己提供一种简洁的方法,并将其作为一种解决之道。例。

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

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