Patchwork [remotenames] remotenames: be compatible with upstream change about smartset

login
register
mail settings
Submitter Jun Wu
Date Feb. 10, 2017, 9:15 p.m.
Message ID <cefa2cc8e03941120286.1486761339@localhost.localdomain>
Download mbox | patch
Permalink /patch/18415/
State Accepted
Headers show

Comments

Jun Wu - Feb. 10, 2017, 9:15 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1486761243 28800
#      Fri Feb 10 13:14:03 2017 -0800
# Node ID cefa2cc8e03941120286a1c8819dd7d5d62ae84b
# Parent  18f8e0f8ba54270bf158734c781327581cf43634
remotenames: be compatible with upstream change about smartset

The revset sets are moved to smartset.
Sean Farley - Feb. 13, 2017, 11:38 p.m.
Jun Wu <quark@fb.com> writes:

> # HG changeset patch
> # User Jun Wu <quark@fb.com>
> # Date 1486761243 28800
> #      Fri Feb 10 13:14:03 2017 -0800
> # Node ID cefa2cc8e03941120286a1c8819dd7d5d62ae84b
> # Parent  18f8e0f8ba54270bf158734c781327581cf43634
> remotenames: be compatible with upstream change about smartset
>
> The revset sets are moved to smartset.

Thanks! Queued :-)

Patch

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -45,4 +45,9 @@  from hgext import schemes
 from hgext.convert import hg as converthg
 
+try:
+    from mercurial import smartset
+except ImportError:
+    smartset = revset
+
 # namespace to use when recording an hg journal entry
 journalremotebookmarktype = 'remotebookmark'
@@ -1574,8 +1579,8 @@  def upstream_revs(filt, repo, subset, x)
 
     if not upstream_tips:
-        return revset.baseset([])
+        return smartset.baseset([])
 
     tipancestors = repo.revs('::%ln', upstream_tips)
-    return revset.filteredset(subset, lambda n: n in tipancestors)
+    return smartset.filteredset(subset, lambda n: n in tipancestors)
 
 def upstream(repo, subset, x):
@@ -1627,5 +1632,5 @@  def remotenamesrevset(repo, subset, x):
 
     results = (cl.rev(n) for n in remoterevs if n in repo)
-    return subset & revset.baseset(sorted(results))
+    return subset & smartset.baseset(sorted(results))
 
 revset.symbols.update({'upstream': upstream,