Patchwork [STABLE] revset: fix first and last for generatorset (issue4465)

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 1, 2014, 1:31 p.m.
Message ID <e712c72007588e77b1a5.1417440691@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6931/
State Accepted
Commit 0c432696dae340162bc7818fddf743774c83ee46
Headers show

Comments

Pierre-Yves David - Dec. 1, 2014, 1:31 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1417439892 28800
#      Mon Dec 01 05:18:12 2014 -0800
# Branch stable
# Node ID e712c72007588e77b1a5f46ba3fdfdcc8aff15e3
# Parent  edf29f9c15f0f171847f4c7a8184cca4e95c8b31
revset: fix first and last for generatorset (issue4465)

The code was just plain wrong.
Mads Kiilerich - Dec. 1, 2014, 1:37 p.m.
On 12/01/2014 02:31 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1417439892 28800
> #      Mon Dec 01 05:18:12 2014 -0800
> # Branch stable
> # Node ID e712c72007588e77b1a5f46ba3fdfdcc8aff15e3
> # Parent  edf29f9c15f0f171847f4c7a8184cca4e95c8b31
> revset: fix first and last for generatorset (issue4465)
>
> The code was just plain wrong.

LGTM

> +Even with strange revset (issue4465)
> +
> +  $ hg merge ::.

but I liked the look of "..." ;-)

/Mads
Matt Mackall - Dec. 1, 2014, 8:42 p.m.
On Mon, 2014-12-01 at 05:31 -0800, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1417439892 28800
> #      Mon Dec 01 05:18:12 2014 -0800
> # Branch stable
> # Node ID e712c72007588e77b1a5f46ba3fdfdcc8aff15e3
> # Parent  edf29f9c15f0f171847f4c7a8184cca4e95c8b31
> revset: fix first and last for generatorset (issue4465)

Queued for stable, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2802,11 +2802,11 @@  class generatorset(abstractsmartset):
             # we need to consume all and try again
             for x in self._consumegen():
                 pass
             return self.first()
         if self:
-            return it.next()
+            return it().next()
         return None
 
     def last(self):
         if self._ascending:
             it = self.fastdesc
@@ -2816,11 +2816,11 @@  class generatorset(abstractsmartset):
             # we need to consume all and try again
             for x in self._consumegen():
                 pass
             return self.first()
         if self:
-            return it.next()
+            return it().next()
         return None
 
 def spanset(repo, start=None, end=None):
     """factory function to dispatch between fullreposet and actual spanset
 
diff --git a/tests/test-issue619.t b/tests/test-issue619.t
--- a/tests/test-issue619.t
+++ b/tests/test-issue619.t
@@ -26,5 +26,11 @@  Bogus fast-forward should fail:
 
   $ hg merge b
   abort: merging with a working directory ancestor has no effect
   [255]
 
+Even with strange revset (issue4465)
+
+  $ hg merge ::.
+  abort: merging with a working directory ancestor has no effect
+  [255]
+