--- a/hgext3rd/evolve/compat.py Thu Dec 26 22:32:44 2019 +0700
+++ b/hgext3rd/evolve/compat.py Tue Dec 31 21:41:22 2019 +0700
@@ -12,7 +12,6 @@
from mercurial import (
context,
copies,
- encoding,
mdiff,
obsolete,
obsutil,
@@ -446,86 +445,6 @@
if not fixupstreamed:
copies._fullcopytracing = fixedcopytracing
-if not util.safehasattr(obsutil, "_succs"):
- class _succs(list):
- """small class to represent a successors with some metadata about it"""
-
- def __init__(self, *args, **kwargs):
- super(_succs, self).__init__(*args, **kwargs)
- self.markers = set()
-
- def copy(self):
- new = _succs(self)
- new.markers = self.markers.copy()
- return new
-
- @util.propertycache
- def _set(self):
- # immutable
- return set(self)
-
- def canmerge(self, other):
- return self._set.issubset(other._set)
-else:
- from mercurial.obsutil import _succs
-
-def wrap_succs(succs):
- """ Wrap old data format of successorsets (tuple) only if if's not yet a
- _succs instance
- """
-
- if not util.safehasattr(succs, "markers"):
- return _succs(succs)
- else:
- return succs
-
-if not util.safehasattr(obsutil, "markersdates"):
- MARKERS_DATE_COMPAT = True
-else:
- MARKERS_DATE_COMPAT = False
-
-def markersdates(markers):
- """returns the list of dates for a list of markers
- """
- if MARKERS_DATE_COMPAT is False:
- return obsutil.markersdates(markers)
-
- return [m[4] for m in markers]
-
-if not util.safehasattr(obsutil, "markersusers"):
- MARKERS_USERS_COMPAT = True
-else:
- MARKERS_USERS_COMPAT = False
-
-def markersusers(markers):
- """ Returns a sorted list of markers users without duplicates
- """
- if MARKERS_USERS_COMPAT is False:
- return obsutil.markersusers(markers)
-
- markersmeta = [dict(m[3]) for m in markers]
- users = set(encoding.tolocal(meta[b'user']) for meta in markersmeta
- if meta.get(b'user'))
-
- return sorted(users)
-
-if not util.safehasattr(obsutil, "markersoperations"):
- MARKERS_OPERATIONS_COMPAT = True
-else:
- MARKERS_OPERATIONS_COMPAT = False
-
-def markersoperations(markers):
- """ Returns a sorted list of markers operations without duplicates
- """
- if MARKERS_OPERATIONS_COMPAT is False:
- return obsutil.markersoperations(markers)
-
- markersmeta = [dict(m[3]) for m in markers]
- operations = set(meta.get(b'operation') for meta in markersmeta
- if meta.get(b'operation'))
-
- return sorted(operations)
-
# help category compatibility
# hg <= 4.7 (c303d65d2e34)
def helpcategorykwargs(categoryname):
--- a/hgext3rd/evolve/obshistory.py Thu Dec 26 22:32:44 2019 +0700
+++ b/hgext3rd/evolve/obshistory.py Tue Dec 31 21:41:22 2019 +0700
@@ -115,7 +115,7 @@
fullsuccessorsets = [] # successor set + markers
for sset in ssets:
if sset:
- fullsuccessorsets.append(compat.wrap_succs(sset))
+ fullsuccessorsets.append(sset)
else:
# successorsset return an empty set() when ctx or one of its
# successors is pruned.
@@ -131,11 +131,11 @@
for mark in succsmap.get(ctx.node(), ()):
if not mark[1]:
foundany = True
- sset = compat._succs()
+ sset = obsutil._succs()
sset.markers.add(mark)
fullsuccessorsets.append(sset)
if not foundany:
- fullsuccessorsets.append(compat._succs())
+ fullsuccessorsets.append(obsutil._succs())
values = []
for sset in fullsuccessorsets:
@@ -701,7 +701,7 @@
label=b"evolve.node")
# Operations
- operations = compat.markersoperations(markers)
+ operations = obsutil.markersoperations(markers)
if operations:
fm.plain(b' using ')
fm.write(b'operation', b'%s', b", ".join(operations), label=b"evolve.operation")
@@ -709,13 +709,13 @@
fm.plain(b' by ')
# Users
- users = compat.markersusers(markers)
+ users = obsutil.markersusers(markers)
fm.write(b'user', b'%s', b", ".join(users),
label=b"evolve.user")
fm.plain(b' ')
# Dates
- dates = compat.markersdates(markers)
+ dates = obsutil.markersdates(markers)
if dates:
min_date = min(dates)
max_date = max(dates)