Subject: How to do equivalent of "git-reset --hard" and "git revert HEAD" using jgit?

From: Farrukh Najmi <[email-masked]>
Date: Thu, 13 Nov 2008 12:43:16 -0500

I need some guidance on how use jgit to implement the following methods:

     /**
      * Rolls back all uncommitted changes so Index and worspace are 
rolled to committed state in HEAD version.
      * Functionally equivalent to "git reset --hard HEAD"
      *
      */
     public void rollback() {
     }

     /**
      * Undoes the last commit.
      * Functionally equivalent to "git revert HEAD"
      *
      * @param versionNameToRevertTo Version of Commit to revert to
      */
     public void revert(String versionNameToRevertTo) {
     }

It seems that I will have to walk the Tree and check status of each file 
to decide what to do with it. The TreeWalk api is not obvious from the 
javadoc.

TIA for any guidance you can provide.

-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com