Add wc.Context.props_modified.
authorJelmer Vernooij <jelmer@jelmer.uk>
Fri, 4 Aug 2017 11:45:36 +0000 (11:45 +0000)
committerJelmer Vernooij <jelmer@jelmer.uk>
Fri, 4 Aug 2017 11:45:36 +0000 (11:45 +0000)
subvertpy/tests/test_wc.py
subvertpy/wc.c

index f8e0aeb281343450bc4bffd8cd3437b6933af0d2..0d430546f6483140a157caff418e1b1b067377e6 100644 (file)
@@ -342,3 +342,11 @@ class ContextTests(SubversionTestCase):
             f.write("modified")
         self.client_add("checkout/bla.txt")
         self.assertTrue(context.text_modified("checkout/bla.txt"))
+
+    def test_props_modified(self):
+        context = wc.Context()
+        self.make_client("repos", "checkout")
+        with open('checkout/bla.txt', 'w') as f:
+            f.write("modified")
+        self.client_add("checkout/bla.txt")
+        self.assertFalse(context.props_modified("checkout/bla.txt"))
index 110b2924fbc924d5036739ffcee7f4c7c3f19b3f..a61bcf109ae187a56b0dfc669b50f7730f6f1a70 100644 (file)
@@ -1071,6 +1071,34 @@ static PyObject *py_wc_context_text_modified_p2(PyObject *self, PyObject *args)
     return PyBool_FromLong(modified);
 }
 
+static PyObject *py_wc_context_props_modified_p2(PyObject *self, PyObject *args)
+{
+    PyObject* py_path;
+    const char *path;
+    apr_pool_t *pool;
+    svn_wc_context_t *wc_context = ((ContextObject *)self)->context;
+    svn_boolean_t modified;
+
+    if (!PyArg_ParseTuple(args, "O", &py_path))
+        return NULL;
+
+    pool = Pool(NULL);
+
+    path = py_object_to_svn_abspath(py_path, pool);
+    if (path == NULL) {
+        apr_pool_destroy(pool);
+        return NULL;
+    }
+
+    RUN_SVN_WITH_POOL(pool, svn_wc_props_modified_p2(&modified, wc_context,
+                                                    path, pool));
+
+    apr_pool_destroy(pool);
+
+    return PyBool_FromLong(modified);
+}
+
+
 static PyMethodDef context_methods[] = {
        { "locked", py_wc_context_locked, METH_VARARGS, "locked(path) -> (locked_here, locked)\n"
                "Check whether a patch is locked."},
@@ -1078,6 +1106,8 @@ static PyMethodDef context_methods[] = {
         "Check format version of a working copy." },
     { "text_modified", py_wc_context_text_modified_p2, METH_VARARGS, "text_modified(path) -> bool\n"
         "Check whether text of a file is modified against base." },
+    { "props_modified", py_wc_context_props_modified_p2, METH_VARARGS, "props_modified(path) -> bool\n"
+        "Check whether props of a file are modified against base." },
     { NULL }
 };