Question

I am using Mercurial.NET and I need to get the status of one or more files (commited, modified, etc).

How can I use Mercurial.NET or at least Mercurial to do this?

Basically, I need to provide the paths of the desired files to the status command somehow.

I don't want to get a list of all the files and their status and filter them based on their path.

I see that TortoiseHG does this, but I can't figure out how to do this in cmd-line or from within Mercurial.NET.

Was it helpful?

Solution

I see now that :

hg status <path_to_file_in_the_repo>

seems to do what I want. And in Mercurial.NET it is:

        var repo = new Repository(path);
        var s = new StatusCommand();
        s = s.WithInclude(FileStatusIncludes.Modified)
            .WithAdditionalArgument("\"" + file + "\"")
            .WithTimeout(1000);
        s.Validate();
        var ret = repo.Status(s);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top