Patchwork obsfate: makes successorsetverb takes the markers as argument

login
register
mail settings
Submitter Boris Feld
Date Nov. 2, 2017, 12:58 p.m.
Message ID <b5b9f31a676701ca272c.1509627491@FB>
Download mbox | patch
Permalink /patch/25328/
State Superseded
Headers show

Comments

Boris Feld - Nov. 2, 2017, 12:58 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1508409347 -7200
#      Thu Oct 19 12:35:47 2017 +0200
# Node ID b5b9f31a676701ca272c10fc2630e4587413e4e7
# Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
# EXP-Topic fix-obsfate
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b5b9f31a6767
obsfate: makes successorsetverb takes the markers as argument

Right now, successorsetverb only needs successors to compute the verb. But we
will want use additional information (effect-flags and operation) in the near
future to compute a better verb.

Add the markers parameter now so extensions (like Evolve) could wrap the
function and start experimenting around better obsfate verbs.

As successorsetverb now takes both successorset and markers parameters, rename
it to obsfateverb, successorsetandmarkersverb was too long.

Differential Revision: https://phab.mercurial-scm.org/D1191
Pulkit Goyal - Nov. 2, 2017, 8:33 p.m.
Is there any difference between this one and the one you send before
the freeze on Phabricator?

On Thu, Nov 2, 2017 at 6:28 PM, Boris Feld <boris.feld@octobus.net> wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1508409347 -7200
> #      Thu Oct 19 12:35:47 2017 +0200
> # Node ID b5b9f31a676701ca272c10fc2630e4587413e4e7
> # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> # EXP-Topic fix-obsfate
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b5b9f31a6767
> obsfate: makes successorsetverb takes the markers as argument
>
> Right now, successorsetverb only needs successors to compute the verb. But we
> will want use additional information (effect-flags and operation) in the near
> future to compute a better verb.
>
> Add the markers parameter now so extensions (like Evolve) could wrap the
> function and start experimenting around better obsfate verbs.
>
> As successorsetverb now takes both successorset and markers parameters, rename
> it to obsfateverb, successorsetandmarkersverb was too long.
>
> Differential Revision: https://phab.mercurial-scm.org/D1191
>
> diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
> --- a/mercurial/obsutil.py
> +++ b/mercurial/obsutil.py
> @@ -751,8 +751,9 @@ def successorsandmarkers(repo, ctx):
>
>      return values
>
> -def successorsetverb(successorset):
> -    """ Return the verb summarizing the successorset
> +def obsfateverb(successorset, markers):
> +    """ Return the verb summarizing the successorset and potentially using
> +    information from the markers
>      """
>      if not successorset:
>          verb = 'pruned'
> @@ -795,7 +796,7 @@ def obsfateprinter(successors, markers,
>      line = []
>
>      # Verb
> -    line.append(successorsetverb(successors))
> +    line.append(obsfateverb(successors, markers))
>
>      # Operations
>      operations = markersoperations(markers)
> diff --git a/mercurial/templater.py b/mercurial/templater.py
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -1005,17 +1005,18 @@ def obsfateusers(context, mapping, args)
>                  "obsmakers")
>          raise error.ParseError(msg)
>
> -@templatefunc('obsfateverb(successors)')
> +@templatefunc('obsfateverb(successors, markers)')
>  def obsfateverb(context, mapping, args):
>      """Compute obsfate related information based on successors (EXPERIMENTAL)"""
> -    if len(args) != 1:
> +    if len(args) != 2:
>          # i18n: "obsfateverb" is a keyword
> -        raise error.ParseError(_("obsfateverb expects one arguments"))
> +        raise error.ParseError(_("obsfateverb expects two arguments"))
>
>      successors = evalfuncarg(context, mapping, args[0])
> +    markers = evalfuncarg(context, mapping, args[1])
>
>      try:
> -        return obsutil.successorsetverb(successors)
> +        return obsutil.obsfateverb(successors, markers)
>      except TypeError:
>          # i18n: "obsfateverb" is a keyword
>          errmsg = _("obsfateverb first argument should be countable")
> diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
> --- a/tests/test-obsmarker-template.t
> +++ b/tests/test-obsmarker-template.t
> @@ -13,7 +13,7 @@ Global setup
>    > evolution=true
>    > [templates]
>    > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
> -  > obsfateverb = "{obsfateverb(successors)}"
> +  > obsfateverb = "{obsfateverb(successors, markers)}"
>    > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}"
>    > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
>    > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Boris Feld - Nov. 3, 2017, 7 p.m.
No there is not, I just forget I pushed it on phabricator in a first
time. Please ignore this series, I've updated https://phab.mercurial-sc
m.org/D1191 instead.

On Fri, 2017-11-03 at 02:03 +0530, Pulkit Goyal wrote:
> Is there any difference between this one and the one you send before
> the freeze on Phabricator?
> 
> On Thu, Nov 2, 2017 at 6:28 PM, Boris Feld <boris.feld@octobus.net>
> wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@octobus.net>
> > # Date 1508409347 -7200
> > #      Thu Oct 19 12:35:47 2017 +0200
> > # Node ID b5b9f31a676701ca272c10fc2630e4587413e4e7
> > # Parent  3ce0e4b51f789eff195ec900a07c1fa5e8d5c5f2
> > # EXP-Topic fix-obsfate
> > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > #              hg pull https://bitbucket.org/octobus/mercurial-deve
> > l/ -r b5b9f31a6767
> > obsfate: makes successorsetverb takes the markers as argument
> > 
> > Right now, successorsetverb only needs successors to compute the
> > verb. But we
> > will want use additional information (effect-flags and operation)
> > in the near
> > future to compute a better verb.
> > 
> > Add the markers parameter now so extensions (like Evolve) could
> > wrap the
> > function and start experimenting around better obsfate verbs.
> > 
> > As successorsetverb now takes both successorset and markers
> > parameters, rename
> > it to obsfateverb, successorsetandmarkersverb was too long.
> > 
> > Differential Revision: https://phab.mercurial-scm.org/D1191
> > 
> > diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
> > --- a/mercurial/obsutil.py
> > +++ b/mercurial/obsutil.py
> > @@ -751,8 +751,9 @@ def successorsandmarkers(repo, ctx):
> > 
> >      return values
> > 
> > -def successorsetverb(successorset):
> > -    """ Return the verb summarizing the successorset
> > +def obsfateverb(successorset, markers):
> > +    """ Return the verb summarizing the successorset and
> > potentially using
> > +    information from the markers
> >      """
> >      if not successorset:
> >          verb = 'pruned'
> > @@ -795,7 +796,7 @@ def obsfateprinter(successors, markers,
> >      line = []
> > 
> >      # Verb
> > -    line.append(successorsetverb(successors))
> > +    line.append(obsfateverb(successors, markers))
> > 
> >      # Operations
> >      operations = markersoperations(markers)
> > diff --git a/mercurial/templater.py b/mercurial/templater.py
> > --- a/mercurial/templater.py
> > +++ b/mercurial/templater.py
> > @@ -1005,17 +1005,18 @@ def obsfateusers(context, mapping, args)
> >                  "obsmakers")
> >          raise error.ParseError(msg)
> > 
> > -@templatefunc('obsfateverb(successors)')
> > +@templatefunc('obsfateverb(successors, markers)')
> >  def obsfateverb(context, mapping, args):
> >      """Compute obsfate related information based on successors
> > (EXPERIMENTAL)"""
> > -    if len(args) != 1:
> > +    if len(args) != 2:
> >          # i18n: "obsfateverb" is a keyword
> > -        raise error.ParseError(_("obsfateverb expects one
> > arguments"))
> > +        raise error.ParseError(_("obsfateverb expects two
> > arguments"))
> > 
> >      successors = evalfuncarg(context, mapping, args[0])
> > +    markers = evalfuncarg(context, mapping, args[1])
> > 
> >      try:
> > -        return obsutil.successorsetverb(successors)
> > +        return obsutil.obsfateverb(successors, markers)
> >      except TypeError:
> >          # i18n: "obsfateverb" is a keyword
> >          errmsg = _("obsfateverb first argument should be
> > countable")
> > diff --git a/tests/test-obsmarker-template.t b/tests/test-
> > obsmarker-template.t
> > --- a/tests/test-obsmarker-template.t
> > +++ b/tests/test-obsmarker-template.t
> > @@ -13,7 +13,7 @@ Global setup
> >    > evolution=true
> >    > [templates]
> >    > obsfatesuccessors = "{if(successors, " as ")}{join(successors,
> > ", ")}"
> > -  > obsfateverb = "{obsfateverb(successors)}"
> > +  > obsfateverb = "{obsfateverb(successors, markers)}"
> >    > obsfateoperations = "{if(obsfateoperations(markers), " using
> > {join(obsfateoperations(markers), ", ")}")}"
> >    > obsfateusers = "{if(obsfateusers(markers), " by
> > {join(obsfateusers(markers), ", ")}")}"
> >    > obsfatedate = "{if(obsfatedate(markers),
> > "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at
> > {min(obsfatedate(markers))|isodate})", " (between
> > {min(obsfatedate(markers))|isodate} and
> > {max(obsfatedate(markers))|isodate})")}")}"
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -751,8 +751,9 @@  def successorsandmarkers(repo, ctx):
 
     return values
 
-def successorsetverb(successorset):
-    """ Return the verb summarizing the successorset
+def obsfateverb(successorset, markers):
+    """ Return the verb summarizing the successorset and potentially using
+    information from the markers
     """
     if not successorset:
         verb = 'pruned'
@@ -795,7 +796,7 @@  def obsfateprinter(successors, markers, 
     line = []
 
     # Verb
-    line.append(successorsetverb(successors))
+    line.append(obsfateverb(successors, markers))
 
     # Operations
     operations = markersoperations(markers)
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1005,17 +1005,18 @@  def obsfateusers(context, mapping, args)
                 "obsmakers")
         raise error.ParseError(msg)
 
-@templatefunc('obsfateverb(successors)')
+@templatefunc('obsfateverb(successors, markers)')
 def obsfateverb(context, mapping, args):
     """Compute obsfate related information based on successors (EXPERIMENTAL)"""
-    if len(args) != 1:
+    if len(args) != 2:
         # i18n: "obsfateverb" is a keyword
-        raise error.ParseError(_("obsfateverb expects one arguments"))
+        raise error.ParseError(_("obsfateverb expects two arguments"))
 
     successors = evalfuncarg(context, mapping, args[0])
+    markers = evalfuncarg(context, mapping, args[1])
 
     try:
-        return obsutil.successorsetverb(successors)
+        return obsutil.obsfateverb(successors, markers)
     except TypeError:
         # i18n: "obsfateverb" is a keyword
         errmsg = _("obsfateverb first argument should be countable")
diff --git a/tests/test-obsmarker-template.t b/tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t
+++ b/tests/test-obsmarker-template.t
@@ -13,7 +13,7 @@  Global setup
   > evolution=true
   > [templates]
   > obsfatesuccessors = "{if(successors, " as ")}{join(successors, ", ")}"
-  > obsfateverb = "{obsfateverb(successors)}"
+  > obsfateverb = "{obsfateverb(successors, markers)}"
   > obsfateoperations = "{if(obsfateoperations(markers), " using {join(obsfateoperations(markers), ", ")}")}"
   > obsfateusers = "{if(obsfateusers(markers), " by {join(obsfateusers(markers), ", ")}")}"
   > obsfatedate = "{if(obsfatedate(markers), "{ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), " (at {min(obsfatedate(markers))|isodate})", " (between {min(obsfatedate(markers))|isodate} and {max(obsfatedate(markers))|isodate})")}")}"