This is an archive of the discontinued Mercurial Phabricator instance.

histedit: add --retry and --show-plan options
ClosedPublic

Authored by luk on Jul 21 2017, 3:18 PM.
Tags
None
Subscribers

Details

Reviewers
stash
Group Reviewers
Restricted Project
Commits
rFBHGX2b0d67e8ecc6: histedit: add --retry and --show-plan options
Summary

--retry can be used instead of --continue when histedit failed on "exec" (due to it returning a non-zero exit code) and the user wants to repeate that command rather than continuing past it
--show-plan will print the remaining plan of histedit during an interrupted histedit

Test Plan

cd fb-hgext/tests/ && rt

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Branch
default
Lint
Lint OK
Unit
Unit Tests OK

Event Timeline

luk created this revision.Jul 21 2017, 3:18 PM
quark retitled this revision from Add --retry and --show-plan options to histedit to histedit: add --retry and --show-plan options.Jul 21 2017, 4:06 PM
quark added a subscriber: quark.

I have updated the title. See https://www.mercurial-scm.org/wiki/ContributingChanges for the rules. (I think test-check-commit-hg.t would fail in this case).

luk added a comment.Jul 21 2017, 5:56 PM

@quark surprisingly it did not, maybe we should check on it?

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

The main question is about locks

hgext3rd/fbhistedit.py
167

Instead of putting this lines inside every function I suggest to import histedit extension

from hgext import (
    histedit,
)

and check that extension is present in extsetup()

try:
    return extensions.find('histedit')
except KeyError:
    ui.warn(_('histedit extension not found\n') % name)
    return None
179–184

It would be cool to send upstream patches to refactor histedit.py so that adding new goals is trivial.

208

Nit: I think *args is more common than *freeargs

208–217

It seems that this function is identical to histedit() command from histedit.py. I don't think you need to reimplement it

239

I'm not sure why you release the locks here. It seems that all original goals won't use locks, we probably don't want it.

248–257

Can you also add tests that cover these two cases?

This revision now requires changes to proceed.Jul 24 2017, 5:04 AM
luk added inline comments.Jul 24 2017, 5:48 AM
hgext3rd/fbhistedit.py
167

We agreed offline that the extensions.find('histedit') done in local scope is important when user provides a custom histedit in config, because a global import would ignore that config

179–184

With this one in place adding new goals should be easy. At least we don't overcomplicate the upstream code

208

I mimicked the naming from original histedit extension. I don't mind changing it though

208–217

I will try to address this one

239

because orig takes them again, since I wrapcommand histedit. When I apply your suggestion then it won't be necessary anymore

248–257

will do

luk edited edge metadata.Jul 24 2017, 8:13 AM
luk updated this revision to Diff 391.

Addressed @stash comments

luk marked 8 inline comments as done.Jul 24 2017, 8:15 AM
stash accepted this revision.Jul 24 2017, 10:17 AM
stash added inline comments.
hgext3rd/fbhistedit.py
150–151

I think it's better to just raise error.Abort(_('fbhistedit: ...'))
Sorry for not making it clear

240

nit: hints start with small letter

246–247

nit: are you sure about formatting? I think '--retry...' should be exactly below 'amend...'

254

same here - small letter

This revision is now accepted and ready to land.Jul 24 2017, 10:17 AM
luk updated this revision to Diff 394.Jul 24 2017, 12:27 PM

address comments

This revision was automatically updated to reflect the committed changes.