changeset 33733:d5acd967f95a

obsstore: rename precursors into predecessors Use util.nouideprecwarn because obsstore doesn't have easy access to an ui object. The renaming is done according to https://www.mercurial-scm.org/wiki/CEDVocabulary. Differential Revision: https://phab.mercurial-scm.org/D245
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Aug 2017 19:39:08 +0200
parents 32d4f815c4f4
children 0c3112f17610
files mercurial/obsolete.py mercurial/obsutil.py
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Wed Aug 02 19:34:15 2017 +0200
+++ b/mercurial/obsolete.py	Wed Aug 02 19:39:08 2017 +0200
@@ -665,8 +665,16 @@
         _addsuccessors(successors, self._all)
         return successors
 
+    @property
+    def precursors(self):
+        msg = ("'obsstore.precursors' is deprecated, "
+               "use 'obsstore.predecessors'")
+        util.nouideprecwarn(msg, '4.4')
+
+        return self.predecessors
+
     @propertycache
-    def precursors(self):
+    def predecessors(self):
         predecessors = {}
         _addpredecessors(predecessors, self._all)
         return predecessors
@@ -686,8 +694,8 @@
         self._all.extend(markers)
         if self._cached('successors'):
             _addsuccessors(self.successors, markers)
-        if self._cached('precursors'):
-            _addpredecessors(self.precursors, markers)
+        if self._cached('predecessors'):
+            _addpredecessors(self.predecessors, markers)
         if self._cached('children'):
             _addchildren(self.children, markers)
         _checkinvalidmarkers(markers)
@@ -706,7 +714,7 @@
         pendingnodes = set(nodes)
         seenmarkers = set()
         seennodes = set(pendingnodes)
-        precursorsmarkers = self.precursors
+        precursorsmarkers = self.predecessors
         succsmarkers = self.successors
         children = self.children
         while pendingnodes:
@@ -957,7 +965,7 @@
     obsstore = repo.obsstore
     newermap = {}
     for ctx in repo.set('(not public()) - obsolete()'):
-        mark = obsstore.precursors.get(ctx.node(), ())
+        mark = obsstore.predecessors.get(ctx.node(), ())
         toprocess = set(mark)
         seen = set()
         while toprocess:
@@ -971,7 +979,7 @@
             if len(newer) > 1:
                 divergent.add(ctx.rev())
                 break
-            toprocess.update(obsstore.precursors.get(prec, ()))
+            toprocess.update(obsstore.predecessors.get(prec, ()))
     return divergent
 
 
--- a/mercurial/obsutil.py	Wed Aug 02 19:34:15 2017 +0200
+++ b/mercurial/obsutil.py	Wed Aug 02 19:39:08 2017 +0200
@@ -81,7 +81,7 @@
     considered missing.
     """
 
-    precursors = repo.obsstore.precursors
+    precursors = repo.obsstore.predecessors
     stack = [nodeid]
     seen = set(stack)
 
@@ -115,7 +115,7 @@
     while remaining:
         current = remaining.pop()
         yield current
-        for mark in obsstore.precursors.get(current, ()):
+        for mark in obsstore.predecessors.get(current, ()):
             # ignore marker flagged with specified flag
             if mark[2] & ignoreflags:
                 continue
@@ -207,7 +207,7 @@
 
     # shortcut to various useful item
     nm = unfi.changelog.nodemap
-    precursorsmarkers = unfi.obsstore.precursors
+    precursorsmarkers = unfi.obsstore.predecessors
     successormarkers = unfi.obsstore.successors
     childrenmarkers = unfi.obsstore.children