Closed Bug 1216436 Opened 9 years ago Closed 8 years ago

Push-to-try should handle interrupt gracefully

Categories

(Developer Services :: Mercurial: mozext, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: xidorn, Assigned: gps)

Details

Attachments

(1 file)

It sometimes happen that after you press enter for "hg push-to-try" command, you change your mind and decide to stop it, e.g. for picking a different try string.

However, currently, the push-to-try extension cannot handle that gracefully, and it left a abandoned transition in that case, which makes mercurial require an "hg recover" before doing anything else, which is time-consuming.

I think this should be fixed, so that we are free to interrupt this operation at any time, and able to redo that immediately afterwards.
push-to-try: always release transaction object (bug 1216436); r?chmanchester

The proper pattern for transactions is:

tr = repo.transaction(...)
try:
   ...
   tr.close() # or tr.abort()
finally:
   tr.release()

We were forgetting the tr.release() in the finally block, meaning that
the transaction could have not been rolled back.

Surprisingly, I was unable to reproduce the reported bug. But I've added
an explicit test just so we have test coverage.
Attachment #8676348 - Flags: review?(cmanchester)
Comment on attachment 8676348 [details]
MozReview Request: push-to-try: always release transaction object (bug 1216436); r?chmanchester

https://reviewboard.mozilla.org/r/22673/#review20141

Thanks for the fix!

::: hgext/push-to-try/__init__.py:76
(Diff revision 1)
> +        tr.release()

We might want to guard ```if tr:```.
Attachment #8676348 - Flags: review?(cmanchester) → review+
https://hg.mozilla.org/hgcustom/version-control-tools/rev/b0bd5f598d08e0701edf63cf69a51e6605d24b52
push-to-try: always release transaction object (bug 1216436); r=chmanchester
Assignee: nobody → gps
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
It still happens for me:
> $ hg push-to-try -m "try: -b do -p all -u mochitests -t none"
> The following will be pushed to ssh://hg.mozilla.org/try:
> M dom/devicestorage/nsDeviceStorage.h
> Creating temporary commit for remote...
> pushing to ssh://hg.mozilla.org/try
> searching for changes
(Ctrl-C here, it stops)

Then:
> $ hg commit --amend
> abort: abandoned transaction found!
> (run 'hg recover' to clean up transaction)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Windows?
Flags: needinfo?(quanxunzhen)
Yes, Windows.
Flags: needinfo?(quanxunzhen)
The Windows issue this bug was reopened for is bug 1230790.
Status: REOPENED → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: