1

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...)

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
Arthur Blake
  • 105
  • 1
  • 1
  • 6

1 Answers1

1

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...

Arthur Blake
  • 105
  • 1
  • 1
  • 6
  • Does this already work with version 0.1, or is a 0.2-snapshot needed? – Martin Geisler Feb 09 '12 at 14:32
  • I will try this. BTW, might want to consider deprecating `workingCopy` and rename it to `getWorkingCopy` instead (just to follow the conventions that appear to be everywhere else in JavaHg...) – Arthur Blake Feb 09 '12 at 14:42
  • The workingCopy method is not in 0.1, you 0.2-SNAPSHOT or newer. Today a release version of 0.2 was made, and current snapshot is 0.3-SNAPSHOT – Jan Sorensen Feb 09 '12 at 14:45