[PATCH 2 of 3] phases: make advance/retractboundary() atomic

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat May 12 04:16:52 CDT 2012


On Sat, May 12, 2012 at 12:49:49AM +0200, Patrick Mezard wrote:
> # HG changeset patch
> # User Patrick Mezard <patrick at mezard.eu>
> # Date 1336775047 -7200
> # Node ID a15de64e5817ca7bf105e6b56c2ffa37cd20c42b
> # Parent  7cd39b49030833bec83b23c25871a2a18d80ce2a
> phases: make advance/retractboundary() atomic
> 
> Before this, if advanceboundary() failed after updating some roots but
> before calling retractboundary(), the phase cache would be left in an
> invalid state, marked dirty, and written as such. This patch approach is
> to turn advance/retractboundary() into phasecache methods, then operate
> on copies and merge them back on success.
> 
> With the same technique, we can ensure the atomicity of combinations of
> advance/retractboundary() calls, like those performed in changegroup
> handling code.

This looks like a move in the right direction.

> +    phcache = repo._phasecache.copy()
> +    phcache.retractboundary(repo, targetphase, nodes)
> +    repo._phasecache.replace(phcache)
>  
>  def listphases(repo):
>      """List phases root for serialisation over pushkey"""

Are you sure replacing the whole phasecache object is a good idea ?

Do we do that for changelog too ?

-- 
Pierre-Yves


More information about the Mercurial-devel mailing list