This is an archive of the discontinued Mercurial Phabricator instance.

tweakdefaults: make pull --rebase ffwd if nothing to rebase
ClosedPublic

Authored by mbthomas on Aug 25 2017, 10:52 AM.
Tags
None
Subscribers

Details

Summary

Pull --rebase when you have local draft commits moves your commits,
your working copy, and your active bookmark to the new branch head
(or whatever destination you specify with -d). If you don't have
any local draft commits, it doesn't do any of that.

This change makes it so that it does everything except moving the
commits.

Test Plan

Added new unit tests. Re-ran existing ones.

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

mbthomas created this revision.Aug 25 2017, 10:52 AM
mbthomas updated this revision to Diff 1292.Aug 25 2017, 11:18 AM

Add more testing

ryanmce added a subscriber: quark.Aug 25 2017, 11:53 AM
ryanmce accepted this revision.

Looks good, thanks!

hgext3rd/tweakdefaults.py
347–350

yikes! but good explanation!

tests/test-tweakdefaults-pullrebaseremotenames.t
2

Looks like these two tests are the same except with remotenames enabled in one, right?. I think someone (@quark?) implemented some way to do "test cases" to prevent repetition like this.

This revision is now accepted and ready to land.Aug 25 2017, 11:53 AM
mbthomas added inline comments.Aug 25 2017, 11:56 AM
tests/test-tweakdefaults-pullrebaseremotenames.t
2

Almost. Without remotenames you have to provide -d dest to pull --rebase.

ryanmce added inline comments.Aug 25 2017, 12:01 PM
tests/test-tweakdefaults-pullrebaseremotenames.t
2

You still *can* provide it, though.... I'll leave it up to you whether you want to take the time to combine them or not.

quark added inline comments.Aug 25 2017, 12:08 PM
tests/test-tweakdefaults-pullrebaseremotenames.t
2

See https://fburl.com/giq7mtdj or test-amend.t in core hg for examples.

quark requested changes to this revision.EditedAug 25 2017, 12:15 PM

Could we just check if . is an ancestor of dest to decide whether to fast-forward or not, without messing up with rebase internal? In general we prefer not monkey patching core Mercurial or other extensions unless we have to.

It seems we can implement this feature in remotenames cleanly.

This revision now requires changes to proceed.Aug 25 2017, 12:15 PM
quark resigned from this revision.Aug 25 2017, 12:31 PM

I thought it would cause issues with the upcoming rebase changes (D347 stack). But it actually won't. So I'll let you decide what to do.

quark accepted this revision as: Restricted Project.Aug 25 2017, 12:31 PM
This revision is now accepted and ready to land.Aug 25 2017, 12:31 PM
This revision was automatically updated to reflect the committed changes.