mercurial/osutil.c
changeset 31564 102f291807c9
parent 31563 cc3ec3027695
child 31597 2d501fb60b2d
--- a/mercurial/osutil.c	Mon Mar 20 16:24:59 2017 -0700
+++ b/mercurial/osutil.c	Mon Mar 20 16:34:12 2017 -0700
@@ -1079,6 +1079,20 @@
 	/* End of Linux filesystems */
 	return NULL;
 }
+
+static PyObject *pygetfstype(PyObject *self, PyObject *args)
+{
+	const char *path = NULL;
+	if (!PyArg_ParseTuple(args, "s", &path))
+		return NULL;
+
+	const char *type = getfstype(path);
+	if (type == NULL)
+		Py_RETURN_NONE;
+
+	PyObject *result = Py_BuildValue("s", type);
+	return result;
+}
 #endif /* def HAVE_STATFS */
 
 #endif /* ndef _WIN32 */
@@ -1257,6 +1271,10 @@
 	{"setprocname", (PyCFunction)setprocname, METH_VARARGS,
 	 "set process title (best-effort)\n"},
 #endif
+#ifdef HAVE_STATFS
+	{"getfstype", (PyCFunction)pygetfstype, METH_VARARGS,
+	 "get filesystem type (best-effort)\n"},
+#endif
 #endif /* ndef _WIN32 */
 #ifdef __APPLE__
 	{