Patchwork D3936: context: rename descendant() to isancestorof()

login
register
mail settings
Submitter phabricator
Date July 13, 2018, 12:23 p.m.
Message ID <da69a5661ce6f0c8b0173697bc40e746@localhost.localdomain>
Download mbox | patch
Permalink /patch/32832/
State Not Applicable
Headers show

Comments

phabricator - July 13, 2018, 12:23 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfbec9c0b32d3: context: rename descendant() to isancestorof() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3936?vs=9572&id=9582

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

AFFECTED FILES
  mercurial/bookmarks.py
  mercurial/context.py
  mercurial/copies.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -416,14 +416,14 @@ 
     # common ancestor or not without explicitly checking it, it's better to
     # determine that here.
     #
-    # base.descendant(wc) is False, work around that
+    # base.isancestorof(wc) is False, work around that
     _c1 = c1.p1() if c1.rev() is None else c1
     _c2 = c2.p1() if c2.rev() is None else c2
     # an endpoint is "dirty" if it isn't a descendant of the merge base
     # if we have a dirty endpoint, we need to trigger graft logic, and also
     # keep track of which endpoint is dirty
-    dirtyc1 = not base.descendant(_c1)
-    dirtyc2 = not base.descendant(_c2)
+    dirtyc1 = not base.isancestorof(_c1)
+    dirtyc2 = not base.isancestorof(_c2)
     graft = dirtyc1 or dirtyc2
     tca = base
     if graft:
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -589,8 +589,8 @@ 
                             short(n) for n in sorted(cahs) if n != anc))
         return changectx(self._repo, anc)
 
-    def descendant(self, other):
-        """True if other is descendant of this changeset"""
+    def isancestorof(self, other):
+        """True if this changeset is an ancestor of other"""
         return self._repo.changelog.isancestorrev(self._rev, other._rev)
 
     def walk(self, match):
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -813,7 +813,7 @@ 
         return new.node() in obsutil.foreground(repo, [old.node()])
     else:
         # still an independent clause as it is lazier (and therefore faster)
-        return old.descendant(new)
+        return old.isancestorof(new)
 
 def checkformat(repo, mark):
     """return a valid version of a potential bookmark name