Patchwork D6664: transaction: leave unfinished without crashing when not properly released

login
register
mail settings
Submitter phabricator
Date July 31, 2019, 11:46 p.m.
Message ID <487f63171e11d881bb9a317b08a2530e@localhost.localdomain>
Download mbox | patch
Permalink /patch/41105/
State Not Applicable
Headers show

Comments

phabricator - July 31, 2019, 11:46 p.m.
Closed by commit rHG36c692eb28d3: transaction: leave unfinished without crashing when not properly released (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6664?vs=15986&id=16100

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6664/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6664

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1893,6 +1893,12 @@ 
                       **pycompat.strkwargs(tr.hookargs))
         def releasefn(tr, success):
             repo = reporef()
+            if repo is None:
+                # If the repo has been GC'd (and this release function is being
+                # called from transaction.__del__), there's not much we can do,
+                # so just leave the unfinished transaction there and let the
+                # user run `hg recover`.
+                return
             if success:
                 # this should be explicitly invoked here, because
                 # in-memory changes aren't written out at closing