D3931: revlog: introduce a isancestorrev() and use it in rebase
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Jul 12 13:12:12 UTC 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa06b2b032557: revlog: introduce a isancestorrev() and use it in rebase (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3931?vs=9561&id=9567
REVISION DETAIL
https://phab.mercurial-scm.org/D3931
AFFECTED FILES
hgext/rebase.py
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1679,6 +1679,12 @@
A revision is considered an ancestor of itself."""
a, b = self.rev(a), self.rev(b)
+ return self.isancestorrev(a, b)
+
+ def isancestorrev(self, a, b):
+ """return True if revision a is an ancestor of revision b
+
+ A revision is considered an ancestor of itself."""
return self.isdescendantrev(b, a)
def ancestor(self, a, b):
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1291,13 +1291,7 @@
# use unfiltered changelog since successorrevs may return filtered nodes
assert repo.filtername is None
cl = repo.changelog
- def isancestor(a, b):
- # take revision numbers instead of nodes
- if a == b:
- return True
- elif a > b:
- return False
- return cl.isancestor(cl.node(a), cl.node(b))
+ isancestor = cl.isancestorrev
dest = destmap[rev]
oldps = repo.changelog.parentrevs(rev) # old parents
To: martinvonz, indygreg, #hg-reviewers
Cc: lothiraldan, mercurial-devel
More information about the Mercurial-devel
mailing list