[PATCH 1 of 2 V2] debug: add debugexplainunstable that explains instabilities

Anton Shestakov av6 at dwimlabs.net
Wed Mar 14 11:07:16 UTC 2018


On Wed, 28 Feb 2018 00:44:49 +0900
Yuya Nishihara <yuya at tcha.org> wrote:

> On Tue, 27 Feb 2018 21:11:17 +0800, Anton Shestakov wrote:
> > On Tue, 27 Feb 2018 20:45:21 +0900
> > Yuya Nishihara <yuya at tcha.org> wrote:
> > 
> > > On Mon, 26 Feb 2018 22:05:26 +0800, Anton Shestakov wrote:
> > > > # HG changeset patch
> > > > # User Anton Shestakov <av6 at dwimlabs.net>
> > > > # Date 1519649041 -28800
> > > > #      Mon Feb 26 20:44:01 2018 +0800
> > > > # Node ID 0aa1728931cc2c2c7d6ee0f18e0618fc17add42a
> > > > # Parent  aefb75730ea34f545f0756bf8441fc9ae07bf8dc
> > > > debug: add debugexplainunstable that explains instabilities  
> > > 
> > > > diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> > > > --- a/mercurial/obsolete.py
> > > > +++ b/mercurial/obsolete.py
> > > > @@ -1039,3 +1039,35 @@ def createmarkers(repo, relations, flag=
> > > >                                   date=date, metadata=localmetadata,
> > > >                                   ui=repo.ui)
> > > >              repo.filteredrevcache.clear()
> > > > +
> > > > +def explainunstable(repo, ctx):  
> > > 
> > > I think this is an obs"util" function.
> > 
> > I thought so too, but then I noticed that explainunstable() uses
> > `bumpedfix`, which is a constant defined and documented with a pretty
> > long comment in obsolete.py, and the only other use of it is
> > incidentally also in obsolete.py, in a function that computes all
> > phase-divergent changesets (_computephasedivergentset). Its code is
> > very similar to what explainunstable function uses to explain the
> > corresponding instability. So I feel that it's fine to put this function
> > in the same file with the related code. Even if that file is
> > obsutil.py, but then quite a bit of code from obsolete.py would need to
> > be moved there too.
> 
> Thanks for considering it deeply. I don't have strong opinion, but it seems
> we're slowly moving non-core parts out of obsolete.py, and templating stuff
> would be non-core.
> 
> Boris, do you have any preference?

I actually tried to move this function to obsutil, and that required
moving bumpedfix to obsutil too, otherwise there would be a circular
import to resolve (because obsolete, naturally, imports obsutil). But
then I noticed that moving bumpedfix to obsutil breaks evolve extension,
because it expects to find obsolete.bumpedfix. Importing bumpedfix into
obsolete directly (from obsutil import ...) to save evolve from
breaking, in turn, raises a warning because there's only a handful of
modules that are allowed in direct imports (e.g. from node import hex
is allowed).

Not saying it's too difficult, but it just feels that there's sizable
refactoring to be had first if people want this in obsutil. For now
I've sent a V3 that still puts this function into obsolete.py.


More information about the Mercurial-devel mailing list