Patchwork D245: obsstore: rename precursors into predecessors

login
register
mail settings
Submitter phabricator
Date Aug. 7, 2017, 10:09 a.m.
Message ID <differential-rev-PHID-DREV-qdpur4vaklb4nfd2chfe-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22707/
State Superseded
Headers show

Comments

phabricator - Aug. 7, 2017, 10:09 a.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D245

AFFECTED FILES
  mercurial/obsolete.py
  mercurial/obsutil.py

CHANGE DETAILS




To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
phabricator - Aug. 8, 2017, 3:54 p.m.
dsp added inline comments.

INLINE COMMENTS

> obsutil.py:210
>      nm = unfi.changelog.nodemap
> -    precursorsmarkers = unfi.obsstore.precursors
> +    precursorsmarkers = unfi.obsstore.predecessors
>      successormarkers = unfi.obsstore.successors

should this be called `predecessormarkers`?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D245

To: lothiraldan, #hg-reviewers
Cc: dsp, mercurial-devel
phabricator - Aug. 8, 2017, 4:20 p.m.
lothiraldan added inline comments.

INLINE COMMENTS

> dsp wrote in obsutil.py:210
> should this be called `predecessormarkers`?

Ideally yes.

I wanted to limit this series to external impacting changes only (either output or API changes) so extensions and tests could be updated once and for all.

I plan to do variables renaming in a later series as they won't involve test changing or extensions breaking.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D245

To: lothiraldan, #hg-reviewers
Cc: dsp, mercurial-devel

Patch

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -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
 
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -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