# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1499045278 -7200
#      Mon Jul 03 03:27:58 2017 +0200
# Node ID 7e5752579378680270dd356f4e56fd7795109c5d
# Parent  f1e0955f8dda31eef2a65380ea97c35cb637810e
# EXP-Topic obsfatetemplate
obsolete: track markers in _succs

We now also store markers in _succs. It will be useful for the obsfate template 
that
will use them to display more meaningful information like the list of users
that have evolved a changeset into its successors.

diff -r f1e0955f8dda -r 7e5752579378 mercurial/obsutil.py
--- a/mercurial/obsutil.py      Mon Jul 03 03:13:17 2017 +0200
+++ b/mercurial/obsutil.py      Mon Jul 03 03:27:58 2017 +0200
@@ -314,8 +314,14 @@
 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):
-        return _succs(self)
+        new = _succs(self)
+        new.markers = self.markers.copy()
+        return new
 
 def successorssets(repo, initialnode, closest=False, cache=None):
     """Return set of all latest successors of initial nodes
@@ -511,13 +517,16 @@
                 succssets = []
                 for mark in sorted(succmarkers[current]):
                     # successors sets contributed by this marker
-                    markss = [_succs()]
+                    base = _succs()
+                    base.markers.add(mark)
+                    markss = [base]
                     for suc in mark[1]:
                         # cardinal product with previous successors
                         productresult = []
                         for prefix in markss:
                             for suffix in cache[suc]:
                                 newss = prefix.copy()
+                                newss.markers.update(suffix.markers)
                                 for part in suffix:
                                     # do not duplicated entry in successors set
                                     # first entry wins.
@@ -532,12 +541,13 @@
                 candidate = sorted(((set(s), s) for s in succssets if s),
                                    key=lambda x: len(x[1]), reverse=True)
                 for setversion, listversion in candidate:
-                    for seenset in seen:
+                    for seenset, seensuccs in seen:
                         if setversion.issubset(seenset):
+                            seensuccs.markers.update(listversion.markers)
                             break
                     else:
                         final.append(listversion)
-                        seen.append(setversion)
+                        seen.append((setversion, listversion))
                 final.reverse() # put small successors set first
                 cache[current] = final
     return cache[initialnode]
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to