简体   繁体   中英

How to Get Head or Last Commit revision of a file in SharpSVN

I need to read the head version (or last commit) version of a file.

with this approach i get the head version of my working copy,

string workingFolder = @"C:\trunk\Projects\XML\English.xml";
SvnWorkingCopyClient workingCopyClient = new SvnWorkingCopyClient();
SvnWorkingCopyVersion version;
workingCopyClient.GetVersion(workingFolder, out version);
MessageBox.Show(version.End.ToString()); 

But i what i want is to get the head version of my working copy of the file

Deeply appreciate for your time and help

It is the same way as retrieving revisions for a directory:

public long GetfFileRevision(string path) {
        using (SvnClient client = new SvnClient()) {
        SvnInfoEventArgs info;
        try {
            client.GetInfo(path, out info);
            if (info.Revision >= 0) return info.Revision;
        } catch (Exception) {
            return 0;
        }
        return 0;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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