using sharpsvn client.status in c# - c#

I've just read this question, and I have a question about it:
How do I set the client to look at a certain repository? In the example there's a use in the working copy's location, so how can the client know where to check for diffs?
Thanks :)

SVN stores the location of the repository inside the working copy, hence all of those .svn directories that appear after the first checkout.

Related

SharpSVN: How to tell if the Path for SVN checkout is already 'bound' to SVN

I'm trying to programmatically connect to SVN using SharpSvn.
Is it possible to determine if the local folder (path) I want to bind to SVN is already bound?
The reason I ask is becuase I only want to do a CheckOut when the local path has not been bound and if it has then I want to do an Update.
I tried GetInfo but couldn't distinguish between them.
If you are sure that you're using the same url you can actually just call .CheckOut() on the same path again, as that will perform an update.
(This is to allow .CheckOut to be restartable after failing)
The other option would really be .Info() (handling or suppressing errors) or one of the specific functions like TryGetRepository(), or GetWorkingCopyRoot() that return null on failure.

Where should i save an ini file?

I have an ini file in my application but where should i save the file and why should i do that?
If i use Environment.CurrentDirectory where is the file saved if i publish my application?
I also have an additional question, i hope that's okay.
I don't want to create an additional question for that.
If i publish my application how can i create an setup for my application, like the default one, not just this install application windows where you can click install now or not. And where the user could change things like where the application is installed and so on.
Where should a ini-File then the be saved or where would it make sense?
If anybody has a useful link or a good tutorial for this it would be nice.
Thanks in Advance
ApplicationData is probably your best bet:
The directory that serves as a common repository for application-specific data for the current roaming user.
There's also
LocalApplicationData: Current user, non-roaming
CommonApplicationData: All users (not specific to any one user)
Here's how you can get the correct location for storing your file:
Path.Combine(Environment.GetFolderPath(
Environment.SpecialFolder.ApplicationData), "yourFile.ini");
As for your second question, I'm not sure what a good setup program would be. It really is a separate question, but as it's asking about a recommendation for a tool, it may be closed.

How to check if the subversion URL is file or a directory using sharpsvn

First things first - I am sorry if you think this question is utterly stupid.
I am working on an application wherein the user can enter a SVN URL. It can either be a Directory or a file. I am using sharpsvn.
My aim is to somehow know if this url is a directory or a file.
For example : svn://svnrepository/Directory/pascal.cs
or svn://svnrepository/DirectoryName
are both valid entries. Its my job to differentiate between the two and bring out the fact that the former is a file while the latter is a directory.
Can this be done using sharpsvn ?
Thanks and Regards
Gagan
Condireng that it't only a wrapper over a real subversion, for you it should be enough to execute
svn info $path$
in the result set there has to be Node Type string. That would be give you description either it a directory or file.
Hope this helps.
You could use one of the following:
svnlook proplist
svn info
svn ls ... -depth empty
The last two are illustrated in "Check that an svn repository url does not exist".
You can encapsulate those calls in SVNSharp hook following the examples of "How can i get access to the SVN pre-commit message using SharpSVN?"

using svn tortoise features through code

I am writing an application in c# that copies files, and I wanted to only copy files according to their tortoise-svn status.. i.e., I would like to divide the files into modified files vs unmodified.
Is there a way to do this? I've been looking at the different .exe files in the svn/bin folder, but haven't found anything. perhaps theres a dll I am overlooking?
Thanks
Talk to svn directly, use svn status.
http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.tour.cycle.examine.status
Thanks everyone for your help, it finally works... I got it to work using two methods:
either using a process in c# and calling the SubWCRev.exe (if you put in as a process argument the path of the file you want to check for svn modifications, you should get that detail as an output).
and the other way was adding the SubWCRevCOM.exe as a reference and then using it as so:
using LibSubWCRev;
SubWCRev subCheckMod = new SubWCRev();
subCheckMod.GetWCInfo(#file_to_check, true, true);
if (subCheckMod.HasModifications) {...}
thanks again everyone =]
Since your question is tagged as C#, I would suggest looking for .Net bindings to subversion.
SharpSvn looks like it would meet your needs.
TortoiseProc is used for automation, but you need to study its syntax.
If you wanted to use the exes that come with TortoiseSVN look at SubWCRev.exe.

Traverse ftp subfolders to get file sizes in C#

Was wondering if you could point me at a right direction on how to achieve this...
I'm currently working on an application that will check the filespace consumed in a remote FTP server that has folders, subfolders and files.
I managed to get some information using System.NET via FtpWebRequest, FtpResponse, WebRequestMethods & System.IO in my code. However, I'm stuck in how I could manage to traverse subdirectories using the said classes.
Was wondering if you could point me at the right direction on how I could achieve this using C#? Or if there are alternatives that I could use (i.e. powershell, windows command line, etc)? I've tried looking at Chillkat ftp2, but it is not free and some FTP client components have no documentation nor examples on how to use it.
Thank you.
You do this the same way you would download a file. Put the directory in the URL, then set the FtpWebRequest.Method property to WebRequestMethods.Ftp.ListDirectory. This will give you the list of files/subfolders, which you can then traverse manually.
Here's a blog post showing the process, as well as using ListDirectoryDetails to differentiate between files and subdirectories.

Categories