changeset 33758:32d4f815c4f4

obsolete: rename _addprecursors into _addpredecessors Use util.nouideprecwarn because _addpredecessors 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/D244
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Aug 2017 19:34:15 +0200
parents 2cb442bc1a76
children d5acd967f95a
files mercurial/obsolete.py
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Wed Aug 02 19:20:59 2017 +0200
+++ b/mercurial/obsolete.py	Wed Aug 02 19:34:15 2017 +0200
@@ -470,11 +470,18 @@
     for mark in markers:
         successors.setdefault(mark[0], set()).add(mark)
 
+def _addprecursors(*args, **kwargs):
+    msg = ("'obsolete._addprecursors' is deprecated, "
+           "use 'obsolete._addpredecessors'")
+    util.nouideprecwarn(msg, '4.4')
+
+    return _addpredecessors(*args, **kwargs)
+
 @util.nogc
-def _addprecursors(precursors, markers):
+def _addpredecessors(predecessors, markers):
     for mark in markers:
         for suc in mark[1]:
-            precursors.setdefault(suc, set()).add(mark)
+            predecessors.setdefault(suc, set()).add(mark)
 
 @util.nogc
 def _addchildren(children, markers):
@@ -660,9 +667,9 @@
 
     @propertycache
     def precursors(self):
-        precursors = {}
-        _addprecursors(precursors, self._all)
-        return precursors
+        predecessors = {}
+        _addpredecessors(predecessors, self._all)
+        return predecessors
 
     @propertycache
     def children(self):
@@ -680,7 +687,7 @@
         if self._cached('successors'):
             _addsuccessors(self.successors, markers)
         if self._cached('precursors'):
-            _addprecursors(self.precursors, markers)
+            _addpredecessors(self.precursors, markers)
         if self._cached('children'):
             _addchildren(self.children, markers)
         _checkinvalidmarkers(markers)