D242: context: rename troubled into isunstable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As we changed the meaning of unstable between the old vocabulary and the new
  one, we can't reuse the unstable method name at the risk of breaking
  extensions calling unstable and getting a wrong result.
 
  Instead rename troubled into isunstable so extensions will continue to work.
 
  The renaming is done according to
  https://www.mercurial-scm.org/wiki/CEDVocabulary.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -690,7 +690,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
         discovery.checkheads(pushop)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.unstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.unstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
lothiraldan updated this revision to Diff 626.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D242?vs=587&id=626

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -690,7 +690,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
         discovery.checkheads(pushop)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.isunstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.unstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
In reply to this post by dsp (David Soria Parra)
lothiraldan updated this revision to Diff 665.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D242?vs=626&id=665

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -680,7 +680,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     # TODO print more than one instability in the abort
                     # message
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.isunstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.unstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
In reply to this post by dsp (David Soria Parra)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG52c5ff856b49: context: rename troubled into isunstable (authored by lothiraldan).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D242?vs=665&id=700

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -680,7 +680,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     # TODO print more than one instability in the abort
                     # message
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.isunstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.unstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: D242: context: rename troubled into isunstable

Brandon McCaig
On Wed, Aug 09, 2017 at 03:37:26PM +0000, lothiraldan (Boris Feld) wrote:

> diff --git a/mercurial/context.py b/mercurial/context.py ---
> a/mercurial/context.py +++ b/mercurial/context.py @@ -240,6
> +240,12 @@ return self.rev() in obsmod.getrevs(self._repo,
> 'divergent')
>  
>      def troubled(self):
> +        msg = ("'context.troubled' is deprecated, "
> +               "use 'context.isunstable'")
> +        self._repo.ui.deprecwarn(msg, '4.4')
> +        return self.unstable()
Maybe I'm missing something, but shouldn't this be:

        return self.isunstable()

It sounded like context.unstable() has a different purpose and so
troubled was renamed to isunstable and so troubled() itself
should also be calling isunstable().

> +
> +    def isunstable(self):
>          """True if the changeset is either unstable, bumped or divergent"""
>          return self.orphan() or self.phasedivergent() or self.contentdivergent()

Regards,


--
Brandon McCaig <[hidden email]> <[hidden email]>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bambams.ca/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'


_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: D242: context: rename troubled into isunstable

Boris Feld
On Wed, 2017-08-09 at 12:32 -0400, Brandon McCaig wrote:

> On Wed, Aug 09, 2017 at 03:37:26PM +0000, lothiraldan (Boris Feld)
> wrote:
> > diff --git a/mercurial/context.py b/mercurial/context.py ---
> > a/mercurial/context.py +++ b/mercurial/context.py @@ -240,6
> > +240,12 @@ return self.rev() in obsmod.getrevs(self._repo,
> > 'divergent')
> >  
> >      def troubled(self):
> > +        msg = ("'context.troubled' is deprecated, "
> > +               "use 'context.isunstable'")
> > +        self._repo.ui.deprecwarn(msg, '4.4')
> > +        return self.unstable()
>
> Maybe I'm missing something, but shouldn't this be:
>
>         return self.isunstable()
>
> It sounded like context.unstable() has a different purpose and so
> troubled was renamed to isunstable and so troubled() itself
> should also be calling isunstable().

Yes, you are right. I am sending a fix right now on phabricator. Thank
you for the catch.

>
> > +
> > +    def isunstable(self):
> >          """True if the changeset is either unstable, bumped or
> > divergent"""
> >          return self.orphan() or self.phasedivergent() or
> > self.contentdivergent()
>
> Regards,
>
>
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
In reply to this post by dsp (David Soria Parra)
lothiraldan updated this revision to Diff 704.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D242?vs=700&id=704

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -680,7 +680,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     # TODO print more than one instability in the abort
                     # message
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.isunstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.isunstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),



To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

D242: context: rename troubled into isunstable

dsp (David Soria Parra)
In reply to this post by dsp (David Soria Parra)
yuja added inline comments.

INLINE COMMENTS

> context.py:246
> +        self._repo.ui.deprecwarn(msg, '4.4')
> +        return self.isunstable()
> +

Please send a follow-up. This is too far from the tip to amend.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers
Cc: yuja, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: D242: context: rename troubled into isunstable

Boris Feld
On Sun, 2017-08-13 at 05:01 +0000, yuja (Yuya Nishihara) wrote:

> yuja added inline comments.
>
> INLINE COMMENTS
>
> > context.py:246
> > +        self._repo.ui.deprecwarn(msg, '4.4')
> > +        return self.isunstable()
> > +
>
> Please send a follow-up. This is too far from the tip to amend.

I will do send a follow-up, thank you for catching that, I thought it
had been pushed into commited.

>
> REPOSITORY
>   rHG Mercurial
>
> REVISION DETAIL
>   https://phab.mercurial-scm.org/D242
>
> To: lothiraldan, #hg-reviewers
> Cc: yuja, mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Loading...