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

Anton Shestakov av6 at dwimlabs.net
Tue Feb 27 08:11:17 EST 2018


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.

> > +    if ctx.contentdivergent():
> > +        dsets = obsutil.divergentsets(repo, ctx)
> > +        for dset in dsets:
> > +            divnodes = [repo[n] for n in dset['divergentnodes']] # hmm  
> 
> Hmm?

I tried to decide if we want divergentnodes be a list of ctx (easier to
work with) or node hashes (more consistent with "node"), but then forgot
about it.


More information about the Mercurial-devel mailing list