transplant: restore dirstate correctly at unexpected failure...
transplant: restore dirstate correctly at unexpected failure
Before this patch, transplant can't restore dirstate as expected at
failure other than one while patching. This causes:
- unexpected file status
- dirstate refers already rollback-ed parent
(only at failure of transplanting the 2nd or later revision)
To restore dirstate correctly also at unexpected failure, this patch
encloses scope of store lock and transaction by 'dirstateguard'.
This is temporary fixing for stable branch. See
DirstateTransactionPlan wiki page for detail about the future plan to
treat dirstate consistently around scope boundary of transaction.
https://mercurial.selenic.com/wiki/DirstateTransactionPlan
This patch also adds 'if lock' examination for safety
'lock.release()', because creating 'dirstateguard' object may fail
unexpectedly (e.g. IOError for saving dirstate).
BTW, in the test script, putting section header '[extensions]' into
'.hg/hgrc' is needed to fix incomplete disabling 'abort' extension at
4d1382fd96ff.