This is an archive of the discontinued Mercurial Phabricator instance.

perftweaks: add logging for rebase size
ClosedPublic

Authored by durham on Jul 21 2017, 9:00 AM.
Tags
None
Subscribers

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGX66513c593eb6: perftweaks: add logging for rebase size
Summary

Let's add logging for the size of rebases (the number of commits being rebased
and the distance over which they are rebased).

Test Plan

Ran a rebase and saw the data show up in ptail

Diff Detail

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

Event Timeline

durham created this revision.Jul 21 2017, 9:00 AM

I think it would also be interesting to log if we had any conflicts. Of course not in this diff.

hgext3rd/perftweaks.py
28–30

It could be recharge-related brain-rot, but I vaguely remember something like this not working. Don't you have to wrap the actually-included rebase via extensions.find rather than importing it? Or am I remembering some old or non-existent failure case?

45

This will only log when the rebase is started, right? Do we also want to include this info in a rebase --continue, for example?

durham added inline comments.Jul 21 2017, 11:54 AM
hgext3rd/perftweaks.py
45

I only wanted the initial rebase for now, and we can filter out failures by looking error codes. That will let us get fair comparisons of rebases (by excluding conflicts and continues and failures).

durham updated this revision to Diff 376.Jul 21 2017, 12:02 PM

Use extensions.find

quark added a subscriber: quark.Jul 21 2017, 12:07 PM

This will have issue with upcoming multi-dest changes. Do we really care about the precise distance? If not, I think we can just subtract rev numbers, like
abs(destrev - min(rebaseset))

If we can get the precise number, we might as well use it. What about the multi-dest change makes calculating the distance between the destination and the source difficult?

quark requested changes to this revision.Jul 21 2017, 4:58 PM

Consider rebase A to B, B to C, rebase A to C, B to C. They should have similar (+/-1) distance. How would you define distance for it?

I think what we want is the sum of update distance, like when merge.udpate gets executed, how far is it away from the current wd parent. That seems to be a general purpose thing that applies to every command.

Rejecting since I'd love us to go the more general-purposed approach.

This revision now requires changes to proceed.Jul 21 2017, 4:58 PM

Ah, I just noticed D166 does that. Is the rebase change still necessary?

durham edited edge metadata.Jul 31 2017, 1:02 PM
durham requested review of this revision.

We also want to track how many commits are being rebased, which D166 doesn't cover. Also, with inmemory merge, the update distance won't necessarily reflect the rebase distance. Is the multi-dest stuff landed already? If so, what are the input revsets (like here we have dest and rebaseset), so I can construct an appropriate one for multi-target rebases. If that stuff is not landed yet, I'd like to go ahead and land this.

stash added a subscriber: stash.Jul 31 2017, 1:14 PM

perftweaks.py is no longer just a perftweaks. I think it makes sense to split this extension in the future

quark added a comment.EditedJul 31 2017, 1:19 PM
In D169#3132, @durham wrote:

We also want to track how many commits are being rebased, which D166 doesn't cover.

I see. commitcount should work with multi-dest too.

Also, with inmemory merge, the update distance won't necessarily reflect the rebase distance.

My main concern is the rebase distance could not be calculated accurately in an easy way. Even without multi-dest, the current rebase allows -r arbitrary_revset. Something like -r draft() -d master with multiple feature branches could give controversial results. Merge is also a problem. I saw there is a comment saying it could be inaccurate. I'll accept the diff.

Is the multi-dest stuff landed already?

No. Blocked by D21.

stash added inline comments.Jul 31 2017, 1:20 PM
hgext3rd/perftweaks.py
296–300

Just curious: is there a reason you are using two repo.ui.log(...) instead of 1?

quark accepted this revision.Jul 31 2017, 1:21 PM
This revision is now accepted and ready to land.Jul 31 2017, 1:21 PM
quark added inline comments.Jul 31 2017, 1:23 PM
hgext3rd/perftweaks.py
297–299

Maybe make it more clear about order cases:

# The code assumes rebase source is a linear stack within a single feature branch,
# and there is only one destination. If that is not the case, the distance might
# be not accurate.
durham added inline comments.Jul 31 2017, 1:31 PM
hgext3rd/perftweaks.py
296–300

No reason. Just an artifact of how it was developed. I'll combine them.

This revision was automatically updated to reflect the committed changes.