Page MenuHomePhabricator

abort: added support for merge
ClosedPublic

Authored by taapas1128 on Sat, Jun 29, 3:38 PM.

Details

Summary

This adds support of hg merge --abort to hg abort plan.

This involves refactoring hg.merge into two different
functions removing the abort logic of merge from hg.merge
and then creating a seperate hg.abortmerge to handle the
abort logic so that the abortion of merge can be called
independently.

hg.abortmerge is then registered as abortfunc for the
state detection API so that commands.abort can use it to
deal with an unfinished merge operation.

Results are shown as tests.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

taapas1128 created this revision.Sat, Jun 29, 3:38 PM
pulkit added a subscriber: pulkit.Sun, Jun 30, 3:23 PM
pulkit added inline comments.
mercurial/commands.py
161

let's refactor some code and create a function for merge abort instead of special casing it.

mercurial/hg.py
958–959

We can compute node required here again, and hence take this abort related code into a separate function.

taapas1128 updated this revision to Diff 15749.Tue, Jul 2, 4:00 PM
taapas1128 marked 2 inline comments as done.Tue, Jul 2, 4:01 PM
pulkit added inline comments.Tue, Jul 2, 5:51 PM
mercurial/hg.py
959

we can directly pass repo.ui here. No need to have a ui variable

959

we actually don't need stats back here is we call _showstats() in abort merge. The stats related lines below can be moved to if condition above. Hence removing the asflag argument.

taapas1128 edited the summary of this revision. (Show Details)Wed, Jul 3, 7:02 PM
taapas1128 updated this revision to Diff 15755.
taapas1128 marked 2 inline comments as done.Wed, Jul 3, 7:07 PM
taapas1128 updated this revision to Diff 15760.Thu, Jul 4, 1:29 PM
pulkit added inline comments.Thu, Jul 4, 1:38 PM
tests/test-commit-unresolved.t
45 ↗(On Diff #15760)

since there are only two cases, you can use #else here.

169 ↗(On Diff #15760)

We can put only the command in if and else part. The output is same on the both sides.

pulkit added inline comments.Thu, Jul 4, 1:40 PM
tests/test-commit-unresolved.t
1 ↗(On Diff #15760)

abortcommand will be better name instead of hgabort as that will match the way we named abortflag and will be more easier to realise the difference between them.

taapas1128 updated this revision to Diff 15761.Thu, Jul 4, 1:45 PM
taapas1128 marked 3 inline comments as done.Thu, Jul 4, 1:48 PM
taapas1128 marked an inline comment as not done.
pulkit added inline comments.Thu, Jul 4, 1:49 PM
tests/test-commit-unresolved.t
48 ↗(On Diff #15761)

hg abort can be used. we can case the output here.

taapas1128 updated this revision to Diff 15770.Thu, Jul 4, 5:08 PM
taapas1128 marked 2 inline comments as done.Thu, Jul 4, 5:10 PM
taapas1128 updated this revision to Diff 15783.Sat, Jul 6, 2:55 PM
taapas1128 edited the summary of this revision. (Show Details)Mon, Jul 8, 2:18 PM
taapas1128 updated this revision to Diff 15808.
taapas1128 edited the summary of this revision. (Show Details)Tue, Jul 9, 8:25 AM
taapas1128 updated this revision to Diff 15835.
pulkit accepted this revision.Wed, Jul 10, 8:58 AM
This revision is now accepted and ready to land.Wed, Jul 10, 8:58 AM
pulkit added inline comments.Wed, Jul 10, 1:12 PM
mercurial/hg.py
985

We lost return stats.unresolvedcount > 0 in this code movement.

taapas1128 updated this revision to Diff 15858.Wed, Jul 10, 2:22 PM
taapas1128 marked an inline comment as done.Wed, Jul 10, 2:22 PM
taapas1128 updated this revision to Diff 15867.Wed, Jul 10, 3:35 PM
pulkit requested changes to this revision.Wed, Jul 10, 4:25 PM
pulkit added inline comments.
mercurial/hg.py
985

This is not yet addressed.

This revision now requires changes to proceed.Wed, Jul 10, 4:25 PM
taapas1128 updated this revision to Diff 15879.Wed, Jul 10, 4:40 PM
taapas1128 marked an inline comment as done.Wed, Jul 10, 4:41 PM
pulkit added inline comments.Wed, Jul 10, 4:46 PM
mercurial/hg.py
987

Here the user is already running hg merge --abort, so we should not show this message.

Ideally, this if condition should not never when aborting a merge.

pulkit accepted this revision.Wed, Jul 10, 4:50 PM
pulkit added inline comments.
mercurial/hg.py
987

Turns out I am blind and the previous version already had everything correct. I will either apply previous version of fix things in flight.

This revision is now accepted and ready to land.Wed, Jul 10, 4:50 PM
taapas1128 updated this revision to Diff 15880.Wed, Jul 10, 4:52 PM
taapas1128 marked an inline comment as done.Wed, Jul 10, 4:55 PM
This revision was automatically updated to reflect the committed changes.