This is an archive of the discontinued Mercurial Phabricator instance.

graft: start using the cmdstate class to read and write data to graftstate
ClosedPublic

Authored by pulkit on May 24 2018, 5:01 PM.

Details

Summary

This patch replaces the logic to read and write data to graftstate file to use
the state.cmdstate() class.

The previous graftstate format didn't had any version number on top of that, so
we have to catch the CorruptedState error and then read the graftstate in case
of old state files.

This will help us to implement nice additions to graft commands like
--no-commit, --abort, --stop flags.

Passing on test-graft.t shows that things are working fine.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.May 24 2018, 5:01 PM
martinvonz added inline comments.
mercurial/commands.py
2389–2390

Will join these two lines in flight. (I don't know if you're going to make this more complex in the future, but the variable seems unnecessary at this point.)

This revision was automatically updated to reflect the committed changes.