Patchwork [3,of,3] reachableroots: use smartset min

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 27, 2015, 7:25 p.m.
Message ID <04cae949223aef6aad5b.1440703528@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10300/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 27, 2015, 7:25 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1440198744 25200
#      Fri Aug 21 16:12:24 2015 -0700
# Node ID 04cae949223aef6aad5b2bddb2bb34f0973ee590
# Parent  df0a203aa014a3afe3e4c4aa5fc9033e65fcb8c9
reachableroots: use smartset min

smartset min are likely to be optimised, cached or other magical property.
Augie Fackler - Aug. 27, 2015, 9:35 p.m.
On Thu, Aug 27, 2015 at 12:25:28PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1440198744 25200
> #      Fri Aug 21 16:12:24 2015 -0700
> # Node ID 04cae949223aef6aad5b2bddb2bb34f0973ee590
> # Parent  df0a203aa014a3afe3e4c4aa5fc9033e65fcb8c9
> reachableroots: use smartset min

queued this, many thanks

>
> smartset min are likely to be optimised, cached or other magical property.
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -133,11 +133,11 @@ def reachableroots(repo, roots, heads, i
>      If includepath is True, return (<roots>::<heads>)."""
>      if not roots:
>          return baseset()
>      # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
>      # (and if it is not, it should.)
> -    minroot = min(roots)
> +    minroot = roots.min()
>      roots = list(roots)
>      heads = list(heads)
>      try:
>          return repo.changelog.reachableroots(minroot, heads, roots, includepath)
>      except AttributeError:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Yuya Nishihara - Aug. 28, 2015, 2:26 a.m.
On Thu, 27 Aug 2015 12:25:28 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1440198744 25200
> #      Fri Aug 21 16:12:24 2015 -0700
> # Node ID 04cae949223aef6aad5b2bddb2bb34f0973ee590
> # Parent  df0a203aa014a3afe3e4c4aa5fc9033e65fcb8c9
> reachableroots: use smartset min
> 
> smartset min are likely to be optimised, cached or other magical property.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -133,11 +133,11 @@ def reachableroots(repo, roots, heads, i
>      If includepath is True, return (<roots>::<heads>)."""
>      if not roots:
>          return baseset()
>      # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
>      # (and if it is not, it should.)
> -    minroot = min(roots)
> +    minroot = roots.min()
>      roots = list(roots)
>      heads = list(heads)

Forgot to remove the XXX comment?
Pierre-Yves David - Aug. 28, 2015, 6:32 a.m.
On 08/27/2015 07:26 PM, Yuya Nishihara wrote:
> On Thu, 27 Aug 2015 12:25:28 -0700, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david@fb.com>
>> # Date 1440198744 25200
>> #      Fri Aug 21 16:12:24 2015 -0700
>> # Node ID 04cae949223aef6aad5b2bddb2bb34f0973ee590
>> # Parent  df0a203aa014a3afe3e4c4aa5fc9033e65fcb8c9
>> reachableroots: use smartset min
>>
>> smartset min are likely to be optimised, cached or other magical property.
>>
>> diff --git a/mercurial/revset.py b/mercurial/revset.py
>> --- a/mercurial/revset.py
>> +++ b/mercurial/revset.py
>> @@ -133,11 +133,11 @@ def reachableroots(repo, roots, heads, i
>>       If includepath is True, return (<roots>::<heads>)."""
>>       if not roots:
>>           return baseset()
>>       # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
>>       # (and if it is not, it should.)
>> -    minroot = min(roots)
>> +    minroot = roots.min()
>>       roots = list(roots)
>>       heads = list(heads)
>
> Forgot to remove the XXX comment?

I did, fixed on the clowncopter.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -133,11 +133,11 @@  def reachableroots(repo, roots, heads, i
     If includepath is True, return (<roots>::<heads>)."""
     if not roots:
         return baseset()
     # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset
     # (and if it is not, it should.)
-    minroot = min(roots)
+    minroot = roots.min()
     roots = list(roots)
     heads = list(heads)
     try:
         return repo.changelog.reachableroots(minroot, heads, roots, includepath)
     except AttributeError: