This is an archive of the discontinued Mercurial Phabricator instance.

undo: meaningful obs markers for undos
ClosedPublic

Authored by felixmerk on Jul 17 2017, 3:09 PM.
Tags
None
Subscribers

Details

Reviewers
quark
Group Reviewers
Restricted Project
Commits
rFBHGX80f01f00d59a: undo: meaningful obs markers for undos
Summary

Makes obs markers for undos more meaningful. When an undo performs a strict one
to one change, the written obs marker reflects that and the user even gets a
helpful ui message in smartlog. One to many undos do not support such obs
markers (currently) because we can't tell splits and divergence apart easily.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

felixmerk created this revision.Jul 17 2017, 3:09 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 17 2017, 3:09 PM
felixmerk updated this revision to Diff 318.Jul 19 2017, 5:31 PM
quark requested changes to this revision.Jul 19 2017, 6:57 PM
quark added a subscriber: quark.

Function looks good. But there are some easy wins here.

hgext3rd/undo.py
549–558

This is O(N * M) where N = len(related), M = len(destinations). Use set operations to make it something like O(M * log N):

related = set(obsutil.allprecursors(unfi.obsstore, [ctx.node()]))
related.update(obsutil.allsuccessors(unfi.obsstore, [ctx.node()]))
related.intersection_update(x.node() for x in showctxs)

(note: ctxs is more common than ctxts in the existing code base)

tests/test-undo.t
338

It's better to show more information about other nodes, like:

-T "{node|short} {if(undosuccessors, label('sl.undo', '(Undone as {join(undosuccessors% \'{shortest(undosuccessor, 6)}\', ', ')})'))}"

This will show where 1dafc0 is.

This revision now requires changes to proceed.Jul 19 2017, 6:57 PM
felixmerk edited edge metadata.Jul 19 2017, 8:45 PM
felixmerk updated this revision to Diff 326.
quark accepted this revision.Jul 19 2017, 8:46 PM
This revision is now accepted and ready to land.Jul 19 2017, 8:46 PM
This revision was automatically updated to reflect the committed changes.