Search code examples
javahg

How to monitor clone progress with JavaHg


I'm using JavaHg in order to build a customised GUI interface. I was able to clone via code as follows:

BaseRepository repo = Repository.clone(new File(checkout_folder), url);

However, this being a GUI app, it just stalls until the clone is complete. Is there any way to do this clone command while also allowing the GUI to monitor its progress?

My gut feeling is telling me to take a look at the MercurialEclipse plug-in and see how they do it there, but if anyone can suggest an approach, I'd be glad to hear it.

Regards, Gurce

EDIT:

Thanks for the info on both perspectives, one for the reality of the present situation, and for the suggestion of a night-rider progress bar.

I recently opted for a dodgey workaround approach, which I seem to be getting away with for now.

Since I'm hosting my mercurial projects on a hgweb server, I tried doing it this way:

  • A checkout (ok ok, clone! :)) is triggered in my app
  • My app visits the server via ssh and runs a "du" command on the bare repository for the project intending to be checked out
  • So then my app uses the returned total-disk-space-used by that bare-repo as an estimate of the total disk-space the final checkout should have on the local working folder
  • My app then polls the local working folder once a second with the "du" command, to see amount of disk-usage the checkout/clone is currently consuming
  • I use this du result versus the du result from the server to display my progress bar

It's not 100% accurate, but oh well, it seems to do the job ok...


Solution

  • Currently JavaHg doesn't support showing progress of long running operations