Patchwork histedit: don't recreate state object

login
register
mail settings
Submitter Durham Goode
Date Feb. 18, 2015, 4:08 a.m.
Message ID <85b6e8979ba1810cb11d.1424232501@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7806/
State Accepted
Commit 166d69da0530caf7d16b4da14c5a4efa8998a468
Headers show

Comments

Durham Goode - Feb. 18, 2015, 4:08 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1424231966 28800
#      Tue Feb 17 19:59:26 2015 -0800
# Node ID 85b6e8979ba1810cb11dfe149a0099569e0c75d1
# Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
histedit: don't recreate state object

Previously, the histedit state object was being recreated during continue/abort.
This meant that the locks that were held on the original state object were not
available to actions, which meant actions could not release the lock on the
repository (like an 'exec' action would need to do).

This affected our internal extension that added the 'exec' action.
Augie Fackler - Feb. 19, 2015, 8:32 p.m.
On Tue, Feb 17, 2015 at 08:08:21PM -0800, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1424231966 28800
> #      Tue Feb 17 19:59:26 2015 -0800
> # Node ID 85b6e8979ba1810cb11dfe149a0099569e0c75d1
> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> histedit: don't recreate state object

It took some reading and meditation, but I'm convinced that the old
code was buggy anyway, in that it wasn't retaining the locks. Queued.

>
> Previously, the histedit state object was being recreated during continue/abort.
> This meant that the locks that were held on the original state object were not
> available to actions, which meant actions could not release the lock on the
> repository (like an 'exec' action would need to do).
>
> This affected our internal extension that added the 'exec' action.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -593,11 +593,9 @@ def _histedit(ui, repo, state, *freeargs
>
>      # rebuild state
>      if goal == 'continue':
> -        state = histeditstate(repo)
>          state.read()
>          state = bootstrapcontinue(ui, state, opts)
>      elif goal == 'abort':
> -        state = histeditstate(repo)
>          state.read()
>          mapping, tmpnodes, leafs, _ntm = processreplacement(state)
>          ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -593,11 +593,9 @@  def _histedit(ui, repo, state, *freeargs
 
     # rebuild state
     if goal == 'continue':
-        state = histeditstate(repo)
         state.read()
         state = bootstrapcontinue(ui, state, opts)
     elif goal == 'abort':
-        state = histeditstate(repo)
         state.read()
         mapping, tmpnodes, leafs, _ntm = processreplacement(state)
         ui.debug('restore wc to old parent %s\n' % node.short(state.topmost))