[Zope-Checkins] CVS: Zope2 - MergeTemplate.c:1.1.2.2
Jim Fulton
jim@digiciool.com
Wed, 14 Mar 2001 09:56:59 -0500 (EST)
Update of /cvs-repository/Zope2/lib/python/BTrees
In directory korak:/tmp/cvs-serv929
Modified Files:
Tag: Catalog-BTrees-Integration
MergeTemplate.c
Log Message:
added conflict resolution.
--- Updated File MergeTemplate.c in package Zope2 --
--- MergeTemplate.c 2001/03/12 16:24:52 1.1.2.1
+++ MergeTemplate.c 2001/03/14 14:56:59 1.1.2.2
@@ -102,10 +102,16 @@
return 0;
}
-static void
-merge_error()
+static PyObject *
+merge_error(int p1, int p2, int p3, int reason)
{
- PyErr_SetObject(PyExc_ValueError, Py_None);
+ PyObject *r;
+
+ UNLESS (r=Py_BuildValue("iiii", p1, p2, p3, reason)) r=Py_None;
+ PyErr_SetObject(PyExc_ValueError, r);
+ if (r != Py_None) Py_DECREF(r);
+
+ return NULL;
}
static PyObject *
@@ -155,7 +161,7 @@
}
else
{ /* conflicting changes in i2 and i3 */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 1);
goto err;
}
if (i1.next(&i1) < 0) goto err;
@@ -174,7 +180,7 @@
}
else
{ /* conflicting del in i3 and change in i2 */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 2);
goto err;
}
}
@@ -192,7 +198,7 @@
}
else
{ /* conflicting del in i2 and change in i3 */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 3);
goto err;
}
}
@@ -201,7 +207,7 @@
cmp23=TEST_KEY(i2.key, i3.key);
if (cmp23==0)
{ /* dualing inserts */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 4);
goto err;
}
if (cmp12 > 0)
@@ -224,7 +230,7 @@
}
else
{ /* Dueling deletes */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 5);
goto err;
}
}
@@ -235,7 +241,7 @@
cmp23=TEST_KEY(i2.key, i3.key);
if (cmp23==0)
{ /* dualing inserts */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 6);
goto err;
}
if (cmp23 > 0)
@@ -265,7 +271,7 @@
}
else
{ /* Dualing deletes or delete and change */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 7);
goto err;
}
}
@@ -285,14 +291,14 @@
}
else
{ /* Dualing deletes or delete and change */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 8);
goto err;
}
}
if (i1.position >= 0)
{ /* Dueling deletes */
- merge_error();
+ merge_error(i1.position, i2.position, i3.position, 9);
goto err;
}