This is an archive of the discontinued Mercurial Phabricator instance.

synthrepo: use progress helper
ClosedPublic

Authored by martinvonz on Jun 18 2018, 8:45 PM.

Details

Summary

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Jun 18 2018, 8:45 PM
pulkit accepted this revision.Jun 19 2018, 7:10 AM
pulkit added a subscriber: pulkit.
pulkit added inline comments.
contrib/synthrepo.py
178

progress.increment()?

This revision was automatically updated to reflect the committed changes.
martinvonz added inline comments.Jun 19 2018, 12:14 PM
contrib/synthrepo.py
178

That would mean that it would now start at 1 instead of 0. I made that change in one or two other patches and then I felt unsure if that's what we want, so I left the current behavior in this and later patches.

I meant to have a discussion about which behavior we want. For example, when the progress bar says 1/3, do you interpret that as processing the first item or that 1 item is already complete?

A related issue is that it seems like either 0% or 100% wouldn't happen (for more than a split second, regardless of how slow each item is). Let's say we have 3 items. We can then do either of these:

progress.update(0)
for i [1,2,3]:
  progress.update(i)
  process(i)
progress.complete()
progress.update(0)
for i [1,2,3]:
  process(i)
  progress.update(i)
progress.complete()

As you can see, either the 0/3 or the 3/3 step will never really be displayed.

pulkit added inline comments.Jul 1 2018, 5:24 PM
contrib/synthrepo.py
178

(sorry I missed this. I have my phabricator emails turned off)

I meant to have a discussion about which behavior we want. For example, when the progress
bar says 1/3, do you interpret that as processing the first item or that 1 item is already
complete?

I think both :(. In network related bars where number of kbs or mbs are involved I think, 1/3 means 1 is already done. Sometimes in other processing, I think okay this one is processing.

However, I think if have verbs before the progress bars saying processing, sending, recieving, in those cases processing 1/3 will mean processing the 1st item.

I still don't feel strong either way but I will like to have the same meaning throughout core.

martinvonz added inline comments.Jul 2 2018, 1:52 AM
contrib/synthrepo.py
178

Another point is that when we pass an item argument (often a filename), then it's helpful to show it before starting processing of the filename, so one can tell which one is slow. Also, if we updated the progress after processing, the last item would only be printed for a spit second (no matter how long time it took to process it). For those reasons, I now lean towards updating progress before processing. For consistency, I think it makes more sense to update progress before processing also when there's no item argument. I agree about doing it after processing when it's about processed bytes, though.