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.
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.)