[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Automation - is file versioned

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Fri, 16 Oct 2009 21:48:41 +0200

On 13.10.2009 09:05, alexia wrote:
> On Oct 11, 9:17 am, Stefan Küng<tortoise..._at_gmail.com> wrote:
>> On 11.10.2009 02:59, alexia wrote:
>>
>>> Hi all,
>>
>>> I want to automate TortoiseSVN. Is there ant command line which I can
>>> tell if a file is in repository (versioned).
>>> The reason for that is that I want to display the user different menu
>>> items if the file is versioned and if it is not.
>>
>> Starting a new process every time you show a context menu? That's not a
>> good idea because it takes way too long - a context menu has to show up
>> immediately.
>>
>> You should consider using the svn libraries directly and use the
>> corresponding APIs to find out whether a file is versioned or not.
>>
>> You *could* use SubWCRev (either the command line or the COM object) to
>> find out if a file is versioned. I would suggest using the COM object
>> for this.
>> Example in javascript:
>>
>> filesystem = new ActiveXObject("Scripting.FileSystemObject");
>> subwcrevObject = new ActiveXObject("SubWCRev.object");
>> subwcrevObject.GetWCInfo(filesystem.GetAbsolutePathName("file.txt"), 1, 1);
>>
>> if (subwcrevObject.IsSvnItem)
>> WScript.Echo("file is versioned);
>> else
>> WScript.Echo("file is not versioned);
>>
>> http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev-com-...
>>
>> Stefan
>>
>> --
>> ___
>> oo // \\ "De Chelonian Mobile"
>> (_,\/ \_/ \ TortoiseSVN
>> \ \_/_\_/> The coolest Interface to (Sub)Version Control
>> /_/ \_\ http://tortoisesvn.net
>>
>> ------------------------------------------------------http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessa...
>>
>> To unsubscribe from this discussion, e-mail: [dev-unsubscr..._at_tortoisesvn.tigris.org].
>
> Thanks.
>
> Ported it to C#. In case anyone interested.
>
> using LibSubWCRev;
> SubWCRev sub = new SubWCRev();
> sub.GetWCInfo("C:\\PathToMyFile\\MyFile.cc", true, true);
> if (sub.IsSvnItem == true)
> {
> MessageBox.Show("versioned");
> }
> else
> {
> MessageBox.Show("not versioned");
> }
>
> As for the rest of the TortoiseSVN commands ("commit", "revert"...) I
> will have to use TortoiseSVN since there is no COM API in SubWCRev.
> Or am I missing it?

No, there is no COM interface for TortoiseProc, sorry.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2408326
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-10-16 21:48:45 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.