This is an archive of the discontinued Mercurial Phabricator instance.

fbamend: add hide - a simple command for hiding commits
ClosedPublic

Authored by mitrandir on Jul 24 2017, 8:05 AM.
Tags
None
Subscribers

Details

Summary

We have two commands for hiding commits:

  • strip - which has a lot of legacy options and legacy name
  • prune - which allows for creating arbitrary obsolescence markers

Both of them have complicated UI and are suboptimal experiences for unadvanced
user. The hg hide command is very simple, does one job and does it well.

Test Plan

see test

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

mitrandir created this revision.Jul 24 2017, 8:05 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJul 24 2017, 8:05 AM
quark requested changes to this revision.Jul 24 2017, 12:22 PM

As commented on D179, I believe we want to alter visibility without writing anything to obsstore. In the future, hidden will be independent from obsstore in upstream, but we are not there yet.

This revision now requires changes to proceed.Jul 24 2017, 12:22 PM
akushner added inline comments.
hgext3rd/fbamend/hide.py
2

s/an/and/

50–51

Should this be using something like

with repo.wlock(), repo.lock(), repo.transaction('hid'):
quark accepted this revision.Jul 25 2017, 1:14 PM
quark added inline comments.
hgext3rd/fbamend/hide.py
4

Is this accurate?

76

Maybe try scmutil.cleanupnodes then, it removes bookmarks for you.

This revision is now accepted and ready to land.Jul 25 2017, 1:14 PM
quark added inline comments.Jul 25 2017, 9:36 PM
hgext3rd/fbamend/hide.py
76

Sorry. Cleanupnodes will move bookmarks back so it's not useful here.

quark added a comment.EditedJul 25 2017, 10:21 PM

It might be cleaner to re-invent the logic. There are new good practices supported by core, like repo.set to get context objects. with context for locks and transactions, and avoid using commands.update but cmdutil. And use bookmark.applychanges API. Besides, I think the color label could be just be node.

mitrandir marked 2 inline comments as done.Jul 26 2017, 11:29 AM
mitrandir added inline comments.
hgext3rd/fbamend/hide.py
4

I have copied some of the code from prune.py hence the copied copyright header.

mitrandir updated this revision to Diff 411.Jul 26 2017, 11:55 AM

responded to comments, did refactorings suggested by Jun

This revision was automatically updated to reflect the committed changes.