this-Me
this-Me

Reputation: 2145

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(); // some method which should check the svn and compare the working copy of the file.

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.

  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.

Thanks and Best regards

Upvotes: 0

Views: 922

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45083

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...

There is a chapter which is a reference for commands:

SVN Reference.

Explained there is svn info which may help you out well enough.

EDIT:

On the other hand, after reading your altered title, svn status may be what you're looking for?

EDIT 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...

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.

Upvotes: 1

Related Questions