459
svn_wc_status2_t status;
463
static void status_dealloc(PyObject *self)
465
apr_pool_destroy(((StatusObject *)self)->pool);
466
Py_XDECREF(((StatusObject *)self)->entry);
470
static PyMemberDef status_members[] = {
471
{ "entry", T_OBJECT, offsetof(StatusObject, entry), READONLY,
472
"Can be NULL if not under version control." },
473
{ "locked", T_BOOL, offsetof(StatusObject, status.locked), READONLY,
474
"a directory can be 'locked' if a working copy update was interrupted." },
475
{ "copied", T_BOOL, offsetof(StatusObject, status.copied), READONLY,
476
"a file or directory can be 'copied' if it's scheduled for addition-with-history (or part of a subtree that is scheduled as such.)." },
477
{ "switched", T_BOOL, offsetof(StatusObject, status.switched), READONLY,
478
"a file or directory can be 'switched' if the switch command has been used." },
479
{ "url", T_STRING, offsetof(StatusObject, status.url), READONLY,
480
"URL (actual or expected) in repository" },
481
{ "revision", T_LONG, offsetof(StatusObject, status.ood_last_cmt_rev), READONLY,
482
"Set to the youngest committed revision, or SVN_INVALID_REVNUM if not out of date.", },
483
{ "kind", T_INT, offsetof(StatusObject, status.ood_kind), READONLY,
484
"Set to the node kind of the youngest commit, or svn_node_none if not out of date.", },
485
{ "status", T_INT, offsetof(StatusObject, status.text_status), READONLY,
486
"The status of the entry.", },
490
static PyTypeObject Status_Type = {
491
PyObject_HEAD_INIT(NULL) 0,
492
"wc.Status", /* const char *tp_name; For printing, in format "<module>.<name>" */
493
sizeof(StatusObject),
494
0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */
496
/* Methods to implement standard operations */
498
status_dealloc, /* destructor tp_dealloc; */
499
NULL, /* printfunc tp_print; */
500
NULL, /* getattrfunc tp_getattr; */
501
NULL, /* setattrfunc tp_setattr; */
502
NULL, /* cmpfunc tp_compare; */
503
NULL, /* reprfunc tp_repr; */
505
/* Method suites for standard classes */
507
NULL, /* PyNumberMethods *tp_as_number; */
508
NULL, /* PySequenceMethods *tp_as_sequence; */
509
NULL, /* PyMappingMethods *tp_as_mapping; */
511
/* More standard operations (here for binary compatibility) */
513
NULL, /* hashfunc tp_hash; */
514
NULL, /* ternaryfunc tp_call; */
515
NULL, /* reprfunc tp_str; */
516
NULL, /* getattrofunc tp_getattro; */
517
NULL, /* setattrofunc tp_setattro; */
519
/* Functions to access object as input/output buffer */
520
NULL, /* PyBufferProcs *tp_as_buffer; */
522
/* Flags to define presence of optional/expanded features */
523
0, /* long tp_flags; */
525
NULL, /* const char *tp_doc; Documentation string */
527
/* Assigned meaning in release 2.0 */
528
/* call function for all accessible objects */
529
NULL, /* traverseproc tp_traverse; */
531
/* delete references to contained objects */
532
NULL, /* inquiry tp_clear; */
534
/* Assigned meaning in release 2.1 */
535
/* rich comparisons */
536
NULL, /* richcmpfunc tp_richcompare; */
538
/* weak reference enabler */
539
0, /* Py_ssize_t tp_weaklistoffset; */
541
/* Added in release 2.2 */
543
NULL, /* getiterfunc tp_iter; */
544
NULL, /* iternextfunc tp_iternext; */
546
/* Attribute descriptor and subclassing stuff */
547
NULL, /* struct PyMethodDef *tp_methods; */
548
status_members, /* struct PyMemberDef *tp_members; */
552
static PyObject *py_status(const svn_wc_status2_t *status)
555
svn_wc_status2_t *dup_status;
557
ret = PyObject_New(StatusObject, &Status_Type);
561
ret->pool = Pool(NULL);
562
if (ret->pool == NULL)
565
dup_status = svn_wc_dup_status2(status, ret->pool);
566
if (dup_status == NULL)
571
ret->status = *dup_status;
573
ret->entry = py_entry(ret->status.entry);
574
return (PyObject *)ret;
456
579
svn_wc_adm_access_t *adm;
457
580
apr_pool_t *pool;
1984
* Determine the status of a file in the specified working copy.
1986
* :return: A status object.
1988
static PyObject *ra_status(PyObject *self, PyObject *args)
1991
svn_wc_status2_t *st;
1992
apr_pool_t *temp_pool;
1994
AdmObject *admobj = (AdmObject *)self;
1996
if (!PyArg_ParseTuple(args, "s", &path))
1999
ADM_CHECK_CLOSED(admobj);
2001
temp_pool = Pool(NULL);
2002
if (temp_pool == NULL)
2005
RUN_SVN_WITH_POOL(temp_pool,
2008
svn_path_canonicalize(svn_path_join(svn_wc_adm_access_path(admobj->adm), path, temp_pool), temp_pool),
2012
ret = py_status(st);
2014
apr_pool_destroy(temp_pool);
2016
return (PyObject*)ret;
1858
2019
static PyMethodDef adm_methods[] = {
1859
2020
{ "prop_set", adm_prop_set, METH_VARARGS, "S.prop_set(name, value, path, skip_checks=False)" },
1860
2021
{ "access_path", (PyCFunction)adm_access_path, METH_NOARGS,