Search code examples
javamercurialjavahg

How do I get working folder info with JavaHg?


How can I determine what changeset the current working directory of the repository is on? hg identity and hg summary do not yet appear to be implemented in JavaHg.

A third alternative, hg parents is implemented, but doesn't appear to work exactly like the command line version — it looks like it shows the parents I am based off of, but not the actual changeset I am based off of. (hg parents on command line shows both...)


Solution

  • You can do something like this:

    Repository repo = ...
    Changeset parent = repo.workingCopy().getParent1();
    

    The WorkingCopy object also has a getParent2() method that is non-null if you are in a merge...