• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..04-Feb-2021-

libsvn_swig_py/H04-Feb-2021-6,0584,686

svn/H04-Feb-2021-1,177682

tests/H04-Feb-2021-6,1424,385

READMEH A D18-Mar-20132.5 KiB9162

__init__.pyH A D22-Feb-20101.1 KiB260

client.pyH A D04-Feb-2021213.7 KiB4,1912,684

core.cH A D04-Feb-20211.3 MiB40,86335,716

core.pyH A D04-Feb-2021404.4 KiB9,5236,124

delta.pyH A D04-Feb-202168.9 KiB1,6811,033

diff.pyH A D04-Feb-202167.8 KiB1,460940

fs.pyH A D04-Feb-2021125.1 KiB3,1051,915

ra.pyH A D04-Feb-2021123.4 KiB2,9321,800

repos.pyH A D04-Feb-2021133.6 KiB2,7721,769

svn_client.cH A D04-Feb-20211.3 MiB40,72336,918

svn_delta.cH A D04-Feb-2021393.3 KiB11,4099,867

svn_diff.cH A D04-Feb-2021421.8 KiB12,69111,034

svn_fs.cH A D04-Feb-2021565.3 KiB17,87615,668

svn_ra.cH A D04-Feb-2021716.4 KiB20,16617,895

svn_repos.cH A D04-Feb-2021814.3 KiB24,56821,963

svn_wc.cH A D04-Feb-20211.5 MiB43,72839,356

wc.pyH A D04-Feb-2021260.1 KiB5,2253,372

README

1                                -*- text -*-
2
3TRANSLATING PARAMETER LISTS
4
5   The argument-reductions laws of the SWIG bindings something go like
6   this:
7
8     - The module prefix can be omitted.  o:
9
10          void *some_C_function = svn_client_foo;
11
12       becomes:
13
14          import svn.client
15          func = svn.client.foo
16
17       However, the following two alternatives also work:
18
19          # Fully-qualified C name
20          import svn.client
21          func = svn.client.svn_client_foo
22
23          # Star-import imports just svn_* names, not bare 'foo' names.
24          from svn.client import *
25          func = svn_client_foo
26
27     - Python functions don't return errors.  They throw exceptions.
28       Which means that...
29
30     - ...Python functions will return the "other" stuff that the C
31       functions "return" instead.  C functions which populate
32       pointers with new data (you know, values that are returned to
33       the caller, but not as "return values") will return those
34       values directly in Python.  So:
35
36          object_t *returned_obj;
37          SVN_ERR(svn_client_foo(&returned_obj, blah));
38
39       becomes:
40
41          returned_obj = svn.client.foo(blah)
42
43       and:
44
45          err = svn_client_foo(&returned_obj, blah);
46          if (err && err->apr_err == SVN_ERR_...)
47            /* handle it */
48
49       becomes:
50
51          try:
52              returned_obj = svn.client.foo(blah)
53          except:
54              # handle it
55
56     - Callback function/baton pairs get reduced to just callback
57       functions, and the benefit you get from batons is gotten
58       instead through defining the callback function locally and
59       passing the 'baton' data in through Python default arguments.  So:
60
61          struct baton_t { userdata1, ... };
62
63          svn_error_t *cb_func(cb_arg1, ..., void *baton)
64          {
65            baton_t *b = baton;
66            /* do stuff here with b->userdata1... etc. */
67          }
68
69          /* Now use it: */
70          {
71            baton_t *b = { whatever, ... };
72            error = svn_client_foo(cb_func, b);
73          }
74
75       becomes:
76
77          def cb_func(cb_arg1, ..., userdata1=whatever, ...):
78              # do stuff here with userdata1 etc.
79          svn.client.foo(cb_func)
80
81
82RUNNING THE TESTS
83
84   $ cd subversion/bindings/swig/python
85   $ python ./tests/run_all.py --help
86   $ python ./tests/run_all.py [TEST...]
87
88   where TEST can be the name of a test suite ('core', 'mergeinfo',
89   'client', etc.), or see '--help' for other options.  The default is to
90   run the tests in all modules.
91