( )⚙ D173 tweakdefaults: output new hashes when nodes get updated

This is an archive of the discontinued Mercurial Phabricator instance.

tweakdefaults: output new hashes when nodes get updated
ClosedPublic

Authored by jeroenv on Jul 21 2017, 1:21 PM.

Details

Reviewers
ryanmce
Group Reviewers
Restricted Project
Commits
rFBHGXdec644524c33: tweakdefaults: output new hashes when nodes get updated
Summary

Users and particularly automation can benefit from having the new
revision hashes as part of the output of rebase and other operations that
update nodes. Right now, hacks such as getting the tip revision are used to get
that information.

Test Plan

unit tests

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

jeroenv created this revision.Jul 21 2017, 1:21 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 21 2017, 1:21 PM
quark added a subscriber: quark.Jul 21 2017, 4:50 PM

Have you considered wrapping scmutil.cleanupnodes ? That allows people to get new hashes for not only rebase, but also histedit and amend (and more things to come).

hgext3rd/tweakdefaults.py
664

Is the limit useful? I think the source revisions are usually limited.

681

Maybe [:10] can be removed since we have short (equivalent to hex(node)[:12]) already.

tests/test-tweakdefaults-ordering.t
30 ↗(On Diff #377)

This 0000000000 seems weird (same as below). Could you check what's happening here?

stash requested changes to this revision.Jul 24 2017, 5:13 AM
stash added a subscriber: stash.

To your queue to answer questions about scmutil.cleanupnodes

hgext3rd/tweakdefaults.py
664

If you get rid of the maxoutput then loop can be simplified to

for key, value in rebaseruntime.state.iteritems():
tests/test-fbamend-userestack.t
59–62 ↗(On Diff #377)

It probably shouldn't but I'm still curious if it can break current automation.

This revision now requires changes to proceed.Jul 24 2017, 5:13 AM

Will take a look at wrapping scmutil.cleanupnodes.

hgext3rd/tweakdefaults.py
664

We do the same thing in pushrebase. Source can be an arbitrary revset right? For example someone with a lot of heads rebasing everything on top of master. More than happy to get rid of this. cc @durham who advised.

681

This is to shave another 2 characters off to limit output, but I agree that maybe it's a little silly.

jeroenv added inline comments.Jul 24 2017, 5:45 AM
tests/test-fbamend-userestack.t
59–62 ↗(On Diff #377)

I wondered the same. Durham wasn't concerned, mostly due to the unstructured output of rebase. Also this is in fb-hgext. Upstream might be a different story.

stash added inline comments.Jul 24 2017, 6:29 AM
hgext3rd/tweakdefaults.py
664

That actually makes sense, thanks for explanation

jeroenv edited edge metadata.Jul 24 2017, 2:36 PM
jeroenv updated this revision to Diff 395.
  • wrap cleanupnodes
  • add tests
jeroenv retitled this revision from rebase: output new revision hashes to tweakdefaults: output new hashes when nodes get updated.Jul 24 2017, 2:38 PM
jeroenv edited the summary of this revision. (Show Details)
jeroenv removed a reviewer: stash.
jeroenv updated this revision to Diff 396.

Update metadata

ryanmce added inline comments.
hgext3rd/tweakdefaults.py
664

I would make this configurable and if it's 0 have no limit. Then nuclide could, for example, get all the output hashes.

If it's nonzero, divide the number in half and take the first N/2 and last N/2 hashes produced, if more hashes than N are produced. Output a ... in between if we elide any.

The first and last hash are the most important.

677

magic number 50

I don't think the description is too useful either. rebase already prints it out when it says "rebasing...". I think just the mapping is the useful thing here.

ryanmce accepted this revision.Jul 25 2017, 7:43 AM

This is clearly an improvement even if its verbose in some places. Let's get it in and iterate as needed.

This revision is now accepted and ready to land.Jul 25 2017, 7:43 AM
This revision was automatically updated to reflect the committed changes.