[PATCH 06 of 10 V2] revlog: add a native implementation of issnapshot
Boris Feld
boris.feld at octobus.net
Fri Dec 21 06:47:09 EST 2018
# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1545040633 -3600
# Mon Dec 17 10:57:13 2018 +0100
# Node ID d15f3f46ca1e52f06d5b8f3f77c5e2e02912aaa9
# Parent 4067f496c37ec6d10860504186917bb6be83db46
# EXP-Topic sparse-revlog
# Available At https://bitbucket.org/octobus/mercurial-devel/
# hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d15f3f46ca1e
revlog: add a native implementation of issnapshot
This will be used in the next changesets
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -986,6 +986,34 @@ static inline int index_baserev(indexObj
}
}
+static int index_issnapshotrev(indexObject *self, Py_ssize_t rev)
+{
+ int ps[2];
+ Py_ssize_t base;
+ if (rev == -1) {
+ return 1;
+ }
+ base = (Py_ssize_t)index_baserev(self, rev);
+ if (base == rev) {
+ base = -1;
+ }
+ if (base == -2) {
+ assert(PyErr_Occurred());
+ return -1;
+ }
+ if (base == -1) {
+ return 1;
+ }
+ if (index_get_parents(self, rev, ps, (int)rev) < 0) {
+ assert(PyErr_Occurred());
+ return -1;
+ };
+ if (base == ps[0] || base == ps[1]) {
+ return 0;
+ }
+ return index_issnapshotrev(self, base);
+}
+
static PyObject *index_deltachain(indexObject *self, PyObject *args)
{
int rev, generaldelta;
More information about the Mercurial-devel
mailing list