1

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

Gurce
  • 592
  • 7
  • 18

2 Answers2

1

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

johnpeb
  • 406
  • 2
  • 7
1

with a work thread you can solve the hanging part. i'll check the monitoring, but i think a night rider, work in progress bar will do just fine. you'll have to start a thread to handle the communication and let the main thread go on and handle the actions on the gui. there are two options to see if the cloneing is over: -via a callback method (this is the nice, bigbook style way to do this) -check upon the work thread periodicaly (not so good, but if you're into while cycles and hate callbacks it'll do the trick)

Ferko
  • 11
  • 1