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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Dec 1 13:31:31 UTC 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.

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]
+


More information about the Mercurial-devel mailing list