Merge lp:~luoyonggang/subvertpy/python3 into lp:~jelmer/subvertpy/trunk
- python3
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~luoyonggang/subvertpy/python3 |
Merge into: | lp:~jelmer/subvertpy/trunk |
Diff against target: |
3695 lines (+768/-593) 30 files modified
.bzrignore (+2/-0) Makefile (+3/-9) bin/subvertpy-fast-export (+1/-1) examples/ra_commit.py (+1/-1) examples/ra_log.py (+9/-9) examples/ra_replay.py (+11/-11) examples/ra_shell.py (+21/-21) setup.py (+44/-9) subvertpy/__init__.py (+2/-2) subvertpy/_ra.c (+66/-86) subvertpy/_ra_iter_log.c (+4/-4) subvertpy/client.c (+47/-67) subvertpy/delta.py (+8/-7) subvertpy/editor.c (+11/-10) subvertpy/marshall.py (+1/-1) subvertpy/properties.py (+7/-6) subvertpy/py_fixup.h (+118/-0) subvertpy/ra.py (+5/-5) subvertpy/ra_svn.py (+21/-21) subvertpy/repos.c (+31/-30) subvertpy/tests/__init__.py (+10/-11) subvertpy/tests/test_client.py (+31/-31) subvertpy/tests/test_delta.py (+5/-5) subvertpy/tests/test_properties.py (+16/-16) subvertpy/tests/test_ra.py (+61/-61) subvertpy/tests/test_repos.py (+16/-16) subvertpy/tests/test_wc.py (+49/-36) subvertpy/util.c (+85/-51) subvertpy/util.h (+9/-1) subvertpy/wc.c (+73/-65) |
To merge this branch: | bzr merge lp:~luoyonggang/subvertpy/python3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Needs Fixing | ||
Review via email: mp+96917@code.launchpad.net |
Commit message
Description of the change
Test result on windows:
D:\CI\bld\
running test
running build
running build_py
copying subvertpy\
running build_ext
running build_scripts
Running unittest without install.
.E.....
.E.....
=======
ERROR: test_add_recursive (subvertpy.
-------
Traceback (most recent call last):
File "build\
e = adm.entry(
KeyError: "No such entry 'C:\\Users\
=======
ERROR: test_probe_try (subvertpy.
-------
Traceback (most recent call last):
File "build\
self.
AttributeError: 'NoneType' object has no attribute 'access_path'
=======
FAIL: test_is_wc_root (subvertpy.
-------
Traceback (most recent call last):
File "build\
self.
AssertionError: True is not false
-------
Ran 172 tests in 61.694s
FAILED (failures=1, errors=2)
D:\CI\bld\
Yonggang Luo (luoyonggang) wrote : | # |
This is not ready for merge, I am request for *TEST *it:)...
Anyway, it's passed all tests except *three *test failed under Python 2.7
2012/3/11 Jelmer Vernooij <email address hidden>
> Review: Needs Fixing
>
> THis has a lot of conflicts.
> --
> https:/
> You are the owner of lp:~luoyonggang/subvertpy/python3.
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
Jelmer Vernooij (jelmer) wrote : | # |
> This is not ready for merge, I am request for *TEST *it:)...
> Anyway, it's passed all tests except *three *test failed under Python 2.7
I'm not sure I follow? Merge requests are meant to be used to request a branch to be merged into another.
If you're trying to do something else with them, please at least *mention* what that is.
Jelmer
>
> 2012/3/11 Jelmer Vernooij <email address hidden>
>
> > Review: Needs Fixing
> >
> > THis has a lot of conflicts.
> > --
> > https:/
> > You are the owner of lp:~luoyonggang/subvertpy/python3.
> >
>
>
>
> --
> 此致
> 礼
> 罗勇刚
> Yours
> sincerely,
> Yonggang Luo
Yonggang Luo (luoyonggang) wrote : | # |
2012/3/11 Jelmer Vernooij <email address hidden>
> > This is not ready for merge, I am request for *TEST *it:)...
> > Anyway, it's passed all tests except *three *test failed under Python 2.7
> I'm not sure I follow? Merge requests are meant to be used to request a
> branch to be merged into another.
>
> If you're trying to do something else with them, please at least *mention*
> what that is.
>
OK... well, I want to know is there any problem with unittest merge
request? I've got no response..
Or you have other ways to deal with package_data?
>
> Jelmer
> >
> > 2012/3/11 Jelmer Vernooij <email address hidden>
> >
> > > Review: Needs Fixing
> > >
> > > THis has a lot of conflicts.
> > > --
> > > https:/
> > > You are the owner of lp:~luoyonggang/subvertpy/python3.
> > >
> >
> >
> >
> > --
> > 此致
> > 礼
> > 罗勇刚
> > Yours
> > sincerely,
> > Yonggang Luo
> --
> https:/
> You are the owner of lp:~luoyonggang/subvertpy/python3.
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
Jelmer Vernooij (jelmer) wrote : | # |
> 2012/3/11 Jelmer Vernooij <email address hidden>
>
> > > This is not ready for merge, I am request for *TEST *it:)...
> > > Anyway, it's passed all tests except *three *test failed under Python 2.7
> > I'm not sure I follow? Merge requests are meant to be used to request a
> > branch to be merged into another.
> >
> > If you're trying to do something else with them, please at least *mention*
> > what that is.
> >
> OK... well, I want to know is there any problem with unittest merge
> request? I've got no response..
What is a unittest merge request?
> Or you have other ways to deal with package_data?
I don't see how that's relevant in the python3 branch..
Cheers,
Jelmer
Yonggang Luo (luoyonggang) wrote : | # |
2012/3/11 Jelmer Vernooij <email address hidden>
> > 2012/3/11 Jelmer Vernooij <email address hidden>
> >
> > > > This is not ready for merge, I am request for *TEST *it:)...
> > > > Anyway, it's passed all tests except *three *test failed under
> Python 2.7
> > > I'm not sure I follow? Merge requests are meant to be used to request a
> > > branch to be merged into another.
> > >
> > > If you're trying to do something else with them, please at least
> *mention*
> > > what that is.
> > >
> > OK... well, I want to know is there any problem with unittest merge
> > request? I've got no response..
> What is a unittest merge request?
>
> > Or you have other ways to deal with package_data?
> I don't see how that's relevant in the python3 branch..
>
Python 3 is also contained this patch...
merge that first will get this branch be easier to merge.
>
> Cheers,
>
> Jelmer
> --
> https:/
> You are the owner of lp:~luoyonggang/subvertpy/python3.
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
- 2470. By Yonggang Luo
-
Merge mainline again.
- 2471. By Yonggang Luo
-
Merge mainline
- 2472. By Yonggang Luo
-
can pass custom test now.
- 2473. By Yonggang Luo
-
Get unit test to be passed.
- 2474. By Yonggang Luo
-
Remove unecessary file close.
- 2475. By Yonggang Luo
-
Remove unecessary file seek.
- 2476. By Yonggang Luo
-
.....More readable.
- 2477. By Yonggang Luo
-
Use addCleanup instead directly close.
- 2478. By Yonggang Luo
-
enhance PyOS_tmpfile.
- 2479. By Yonggang Luo
-
simplify the logic of py_open_tmp_file by using of
enhanced apr_file_t *apr_file_from_object( PyObject *object, apr_pool_t *pool) - 2480. By Yonggang Luo
-
Remove trailling space.
- 2481. By Yonggang Luo
-
merge duplicated code.
- 2482. By Yonggang Luo
-
comment update.
- 2483. By Yonggang Luo
-
Directly copy the binary files to build directory.
- 2484. By Yonggang Luo
-
more comments.
- 2485. By Yonggang Luo
-
Use svn_dirent_
internal_ style and svn_dirent_ local_style instead svn_path_ canonicalize, because under win32
the svn internal path is differ win32 local path,
such as C:\Path\To\Repos,
the win32 local path representation is C:\Path\To\Repos
but the svn internal path representation is C:/Path/To/Repos, so we need
use svn_dirent_internal_ style and svn_dirent_ local_style - 2486. By Yonggang Luo
-
before svn 1.6, there is no svn_dirent_
internal_ style and svn_dirent_ local_style - 2487. By Yonggang Luo
-
Py_DECREF ret
- 2488. By Yonggang Luo
-
use svn_dirent_
internal_ style and svn_dirent_ local_style - 2489. By Yonggang Luo
-
set sys.path in the right way.
Unmerged revisions
- 2489. By Yonggang Luo
-
set sys.path in the right way.
- 2488. By Yonggang Luo
-
use svn_dirent_
internal_ style and svn_dirent_ local_style - 2487. By Yonggang Luo
-
Py_DECREF ret
- 2486. By Yonggang Luo
-
before svn 1.6, there is no svn_dirent_
internal_ style and svn_dirent_ local_style - 2485. By Yonggang Luo
-
Use svn_dirent_
internal_ style and svn_dirent_ local_style instead svn_path_ canonicalize, because under win32
the svn internal path is differ win32 local path,
such as C:\Path\To\Repos,
the win32 local path representation is C:\Path\To\Repos
but the svn internal path representation is C:/Path/To/Repos, so we need
use svn_dirent_internal_ style and svn_dirent_ local_style - 2484. By Yonggang Luo
-
more comments.
- 2483. By Yonggang Luo
-
Directly copy the binary files to build directory.
- 2482. By Yonggang Luo
-
comment update.
- 2481. By Yonggang Luo
-
merge duplicated code.
- 2480. By Yonggang Luo
-
Remove trailling space.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2012-02-01 12:08:06 +0000 |
3 | +++ .bzrignore 2012-04-07 06:08:21 +0000 |
4 | @@ -7,3 +7,5 @@ |
5 | .testrepository |
6 | .noseids |
7 | apidocs |
8 | +*.dll |
9 | +.*project |
10 | |
11 | === modified file 'Makefile' |
12 | --- Makefile 2011-12-13 18:49:14 +0000 |
13 | +++ Makefile 2012-04-07 06:08:21 +0000 |
14 | @@ -1,13 +1,7 @@ |
15 | PYTHON = python |
16 | PYDOCTOR = pydoctor |
17 | SETUP = $(PYTHON) setup.py |
18 | -ifeq ($(shell $(PYTHON) -c "import sys; print sys.version_info >= (2, 7)"),True) |
19 | -TESTRUNNER = unittest |
20 | -else |
21 | -TESTRUNNER = unittest2.__main__ |
22 | -endif |
23 | DEBUGGER ?= |
24 | -RUNTEST = PYTHONPATH=.:$(PYTHONPATH) $(DEBUGGER) $(PYTHON) -m $(TESTRUNNER) |
25 | |
26 | all: build build-inplace |
27 | |
28 | @@ -20,8 +14,8 @@ |
29 | install:: |
30 | $(SETUP) install |
31 | |
32 | -check:: build-inplace |
33 | - $(RUNTEST) $(TEST_OPTIONS) subvertpy.tests.test_suite |
34 | +check:: |
35 | + $(SETUP) test $(TEST_OPTIONS) |
36 | |
37 | gdb-check:: |
38 | $(MAKE) check DEBUGGER="gdb --args" |
39 | @@ -31,7 +25,7 @@ |
40 | |
41 | clean:: |
42 | $(SETUP) clean |
43 | - rm -f subvertpy/*.so subvertpy/*.o subvertpy/*.pyc |
44 | + rm -f subvertpy/*.so subvertpy/*.o subvertpy/*.pyc subvertpy/*.dll |
45 | |
46 | pydoctor: |
47 | $(PYDOCTOR) --introspect-c-modules -c subvertpy.cfg --make-html |
48 | |
49 | === modified file 'bin/subvertpy-fast-export' |
50 | --- bin/subvertpy-fast-export 2010-12-11 23:22:11 +0000 |
51 | +++ bin/subvertpy-fast-export 2012-04-07 06:08:21 +0000 |
52 | @@ -1,4 +1,4 @@ |
53 | -#!/usr/bin/python |
54 | +#!/usr/bin/python3 |
55 | # |
56 | # svn-fast-export.py |
57 | # ---------- |
58 | |
59 | === modified file 'examples/ra_commit.py' |
60 | --- examples/ra_commit.py 2009-08-04 12:25:53 +0000 |
61 | +++ examples/ra_commit.py 2012-04-07 06:08:21 +0000 |
62 | @@ -2,7 +2,7 @@ |
63 | # Demonstrates how to do a new commit using Subvertpy |
64 | |
65 | import os |
66 | -from cStringIO import StringIO |
67 | +from io import StringIO |
68 | from subvertpy import delta, repos |
69 | from subvertpy.ra import RemoteAccess, Auth, get_username_provider |
70 | |
71 | |
72 | === modified file 'examples/ra_log.py' |
73 | --- examples/ra_log.py 2010-07-25 22:40:00 +0000 |
74 | +++ examples/ra_log.py 2012-04-07 06:08:21 +0000 |
75 | @@ -7,14 +7,14 @@ |
76 | |
77 | for (changed_paths, rev, revprops, has_children) in conn.iter_log(paths=None, |
78 | start=0, end=conn.get_latest_revnum(), discover_changed_paths=True): |
79 | - print "=" * 79 |
80 | - print "%d:" % rev |
81 | - print "Revision properties:" |
82 | - for entry in revprops.items(): |
83 | - print " %s: %s" % entry |
84 | - print "" |
85 | + print("=" * 79) |
86 | + print("%d:" % rev) |
87 | + print("Revision properties:") |
88 | + for entry in list(revprops.items()): |
89 | + print(" %s: %s" % entry) |
90 | + print("") |
91 | |
92 | - print "Changed paths" |
93 | - for path, (action, from_path, from_rev) in changed_paths.iteritems(): |
94 | - print " %s (%s)" % (path, action) |
95 | + print("Changed paths") |
96 | + for path, (action, from_path, from_rev) in changed_paths.items(): |
97 | + print(" %s (%s)" % (path, action)) |
98 | |
99 | |
100 | === modified file 'examples/ra_replay.py' |
101 | --- examples/ra_replay.py 2009-04-04 14:39:10 +0000 |
102 | +++ examples/ra_replay.py 2012-04-07 06:08:21 +0000 |
103 | @@ -10,7 +10,7 @@ |
104 | class MyFileEditor: |
105 | |
106 | def change_prop(self, key, value): |
107 | - print "Change prop: %s -> %r" % (key, value) |
108 | + print("Change prop: %s -> %r" % (key, value)) |
109 | |
110 | def apply_textdelta(self, base_checksum): |
111 | # This should return a function that can receive delta windows |
112 | @@ -24,26 +24,26 @@ |
113 | class MyDirEditor: |
114 | |
115 | def open_directory(self, *args): |
116 | - print "Open dir: %s (base revnum: %r)" % args |
117 | + print("Open dir: %s (base revnum: %r)" % args) |
118 | return MyDirEditor() |
119 | |
120 | def add_directory(self, path, copyfrom_path=None, copyfrom_rev=-1): |
121 | - print "Add dir: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev) |
122 | + print("Add dir: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev)) |
123 | return MyDirEditor() |
124 | |
125 | def open_file(self, *args): |
126 | - print "Open file: %s (base revnum: %r)" % args |
127 | + print("Open file: %s (base revnum: %r)" % args) |
128 | return MyFileEditor() |
129 | |
130 | def add_file(self, path, copyfrom_path=None, copyfrom_rev=-1): |
131 | - print "Add file: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev) |
132 | + print("Add file: %s (from %r:%r)" % (path, copyfrom_path, copyfrom_rev)) |
133 | return MyFileEditor() |
134 | |
135 | def change_prop(self, key, value): |
136 | - print "Change prop %s -> %r" % (key, value) |
137 | + print("Change prop %s -> %r" % (key, value)) |
138 | |
139 | def delete_entry(self, path, revision): |
140 | - print "Delete: %s" % path |
141 | + print("Delete: %s" % path) |
142 | |
143 | def close(self): |
144 | pass |
145 | @@ -52,16 +52,16 @@ |
146 | class MyEditor: |
147 | |
148 | def set_target_revision(self, revnum): |
149 | - print "Target revision: %d" % revnum |
150 | + print("Target revision: %d" % revnum) |
151 | |
152 | def abort(self): |
153 | - print "Aborted" |
154 | + print("Aborted") |
155 | |
156 | def close(self): |
157 | - print "Closed" |
158 | + print("Closed") |
159 | |
160 | def open_root(self, base_revnum): |
161 | - print "/" |
162 | + print("/") |
163 | return MyDirEditor() |
164 | |
165 | |
166 | |
167 | === modified file 'examples/ra_shell.py' |
168 | --- examples/ra_shell.py 2009-05-21 13:13:07 +0000 |
169 | +++ examples/ra_shell.py 2012-04-07 06:08:21 +0000 |
170 | @@ -6,23 +6,23 @@ |
171 | import sys |
172 | |
173 | if len(sys.argv) == 1: |
174 | - print "Usage: %s <url>" % sys.argv |
175 | + print("Usage: %s <url>" % sys.argv) |
176 | |
177 | url = sys.argv[1] |
178 | |
179 | conn = RemoteAccess(url) |
180 | |
181 | def log_printer(changed_paths, rev, revprops, has_children=None): |
182 | - print "=" * 79 |
183 | - print "%d:" % rev |
184 | - print "Revision properties:" |
185 | - for entry in revprops.items(): |
186 | - print " %s: %s" % entry |
187 | - print "" |
188 | + print("=" * 79) |
189 | + print("%d:" % rev) |
190 | + print("Revision properties:") |
191 | + for entry in list(revprops.items()): |
192 | + print(" %s: %s" % entry) |
193 | + print("") |
194 | |
195 | - print "Changed paths:" |
196 | - for path, (action, from_path, from_rev) in changed_paths.iteritems(): |
197 | - print " %s (%s)" % (path, action) |
198 | + print("Changed paths:") |
199 | + for path, (action, from_path, from_rev) in changed_paths.items(): |
200 | + print(" %s (%s)" % (path, action)) |
201 | |
202 | |
203 | class RaCmd(cmd.Cmd): |
204 | @@ -42,17 +42,17 @@ |
205 | def do_help(self, args): |
206 | for name in sorted(self.__class__.__dict__): |
207 | if name.startswith("do_"): |
208 | - print name[3:] |
209 | + print(name[3:]) |
210 | |
211 | def do_stat(self, args): |
212 | path, revnum = self.parse_path_revnum(args) |
213 | - print conn.stat(path, revnum) |
214 | + print(conn.stat(path, revnum)) |
215 | |
216 | def do_ls(self, args): |
217 | path, revnum = self.parse_path_revnum(args) |
218 | (dirents, fetched_rev, props) = conn.get_dir(path, revnum) |
219 | for name in dirents: |
220 | - print name |
221 | + print(name) |
222 | |
223 | def do_cat(self, args): |
224 | path, revnum = self.parse_path_revnum(args) |
225 | @@ -66,27 +66,27 @@ |
226 | conn.change_rev_prop(int(revnum), name, value) |
227 | |
228 | def do_has_capability(self, args): |
229 | - print conn.has_capability(args) |
230 | + print(conn.has_capability(args)) |
231 | |
232 | def do_revprops(self, args): |
233 | - for item in conn.rev_proplist(int(args)).iteritems(): |
234 | - print "%s: %s" % item |
235 | + for item in conn.rev_proplist(int(args)).items(): |
236 | + print("%s: %s" % item) |
237 | |
238 | def do_check_path(self, args): |
239 | path, revnum = self.parse_path_revnum(args) |
240 | kind = conn.check_path(path, revnum) |
241 | if kind == subvertpy.NODE_DIR: |
242 | - print "dir" |
243 | + print("dir") |
244 | elif kind == subvertpy.NODE_FILE: |
245 | - print "file" |
246 | + print("file") |
247 | else: |
248 | - print "nonexistant" |
249 | + print("nonexistant") |
250 | |
251 | def do_uuid(self, args): |
252 | - print conn.get_uuid() |
253 | + print(conn.get_uuid()) |
254 | |
255 | def do_get_repos_root(self, args): |
256 | - print conn.get_repos_root() |
257 | + print(conn.get_repos_root()) |
258 | |
259 | def do_log(self, args): |
260 | conn.get_log(callback=log_printer, paths=None, start=0, |
261 | |
262 | === modified file 'setup.py' |
263 | --- setup.py 2012-03-04 16:58:04 +0000 |
264 | +++ setup.py 2012-04-07 06:08:21 +0000 |
265 | @@ -2,9 +2,9 @@ |
266 | # Setup file for subvertpy |
267 | # Copyright (C) 2005-2010 Jelmer Vernooij <jelmer@samba.org> |
268 | |
269 | -from distutils.core import setup |
270 | +from distutils.core import setup, Command |
271 | from distutils.extension import Extension |
272 | -from distutils.command.install_lib import install_lib |
273 | +from distutils.command.build import build |
274 | from distutils import log |
275 | import sys |
276 | import os |
277 | @@ -277,11 +277,45 @@ |
278 | Extension.__init__(self, name, *args, **kwargs) |
279 | |
280 | |
281 | -# On Windows, we install the apr binaries too. |
282 | -class install_lib_with_dlls(install_lib): |
283 | +class TestCommand(Command): |
284 | + """Command for running unittests without install.""" |
285 | + |
286 | + user_options = [("args=", None, '''The command args string passed to |
287 | + unittest framework, such as |
288 | + --args="-v -f"''')] |
289 | + |
290 | + def initialize_options(self): |
291 | + self.args = '' |
292 | + pass |
293 | + |
294 | + def finalize_options(self): |
295 | + pass |
296 | + |
297 | + def run(self): |
298 | + self.run_command('build') |
299 | + bld = self.distribution.get_command_obj('build') |
300 | + #Add build_lib in to sys.path so that unittest can found DLLs and libs |
301 | + sys.path = [os.path.abspath(bld.build_lib)] + sys.path |
302 | + os.chdir(bld.build_lib) |
303 | + log.info("Running unittest without install.") |
304 | + |
305 | + import shlex |
306 | + import unittest |
307 | + test_argv0 = [sys.argv[0] + ' test --args='] |
308 | + #For transfering args to unittest, we have to split args |
309 | + #by ourself, so that command like: |
310 | + #python setup.py test --args="-v -f" |
311 | + #can be executed, and the parameter '-v -f' can be |
312 | + #transfering to unittest properly. |
313 | + test_argv = test_argv0 + shlex.split(self.args) |
314 | + unittest.main(module=None, defaultTest='subvertpy.tests.test_suite', argv=test_argv) |
315 | + |
316 | + |
317 | +class BuildWithDLLs(build): |
318 | def _get_dlls(self): |
319 | # return a list of of (FQ-in-name, relative-out-name) tuples. |
320 | ret = [] |
321 | + # the apr binaries. |
322 | apr_bins = [libname + ".dll" for libname in extra_libs |
323 | if libname.startswith("libapr")] |
324 | if get_svn_version() >= (1,5,0): |
325 | @@ -297,11 +331,11 @@ |
326 | look_dirs = os.environ.get("PATH","").split(os.pathsep) |
327 | look_dirs.insert(0, os.path.join(os.environ["SVN_DEV"], "bin")) |
328 | |
329 | + target = os.path.abspath(os.path.join(self.build_lib, 'subvertpy')) |
330 | for bin in apr_bins: |
331 | for look in look_dirs: |
332 | f = os.path.join(look, bin) |
333 | if os.path.isfile(f): |
334 | - target = os.path.join(self.install_dir, "subvertpy", bin) |
335 | ret.append((f, target)) |
336 | break |
337 | else: |
338 | @@ -310,20 +344,21 @@ |
339 | return ret |
340 | |
341 | def run(self): |
342 | - install_lib.run(self) |
343 | + build.run(self) |
344 | # the apr binaries. |
345 | # On Windows we package up the apr dlls with the plugin. |
346 | for s, d in self._get_dlls(): |
347 | self.copy_file(s, d) |
348 | |
349 | def get_outputs(self): |
350 | - ret = install_lib.get_outputs(self) |
351 | + ret = build.get_outputs(self) |
352 | ret.extend([info[1] for info in self._get_dlls()]) |
353 | return ret |
354 | |
355 | -cmdclass = {} |
356 | +cmdclass = {'test': TestCommand} |
357 | if os.name == 'nt': |
358 | - cmdclass['install_lib'] = install_lib_with_dlls |
359 | + # BuildWithDLLs can copy external DLLs into source directory. |
360 | + cmdclass['build'] = BuildWithDLLs |
361 | |
362 | def source_path(filename): |
363 | return os.path.join("subvertpy", filename) |
364 | |
365 | === modified file 'subvertpy/__init__.py' |
366 | --- subvertpy/__init__.py 2012-03-26 09:44:03 +0000 |
367 | +++ subvertpy/__init__.py 2012-04-07 06:08:21 +0000 |
368 | @@ -121,13 +121,13 @@ |
369 | return True |
370 | |
371 | try: |
372 | - import client, _ra, repos, wc |
373 | + from . import client, _ra, repos, wc |
374 | for x in client, _ra, repos, wc: |
375 | if not _check_mtime(x): |
376 | from warnings import warn |
377 | warn("subvertpy extensions are outdated and need to be rebuilt") |
378 | break |
379 | -except ImportError, e: |
380 | +except ImportError as e: |
381 | raise ImportError("Unable to load subvertpy extensions: %s" % e) |
382 | |
383 | |
384 | |
385 | === modified file 'subvertpy/_ra.c' |
386 | --- subvertpy/_ra.c 2012-02-24 06:40:23 +0000 |
387 | +++ subvertpy/_ra.c 2012-04-07 06:08:21 +0000 |
388 | @@ -28,8 +28,8 @@ |
389 | |
390 | #include <structmember.h> |
391 | |
392 | +#include "util.h" |
393 | #include "editor.h" |
394 | -#include "util.h" |
395 | #include "ra.h" |
396 | |
397 | #if ONLY_SINCE_SVN(1, 5) |
398 | @@ -40,11 +40,11 @@ |
399 | |
400 | static PyObject *busy_exc; |
401 | |
402 | -staticforward PyTypeObject Reporter_Type; |
403 | -staticforward PyTypeObject RemoteAccess_Type; |
404 | -staticforward PyTypeObject AuthProvider_Type; |
405 | -staticforward PyTypeObject CredentialsIter_Type; |
406 | -staticforward PyTypeObject Auth_Type; |
407 | +static PyTypeObject Reporter_Type; |
408 | +static PyTypeObject RemoteAccess_Type; |
409 | +static PyTypeObject AuthProvider_Type; |
410 | +static PyTypeObject CredentialsIter_Type; |
411 | +static PyTypeObject Auth_Type; |
412 | |
413 | static bool ra_check_svn_path(char *path) |
414 | { |
415 | @@ -294,7 +294,7 @@ |
416 | } |
417 | |
418 | static PyTypeObject Reporter_Type = { |
419 | - PyObject_HEAD_INIT(NULL) 0, |
420 | + PyVarObject_HEAD_INIT(NULL, 0) |
421 | "_ra.Reporter", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
422 | sizeof(ReporterObject), |
423 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
424 | @@ -481,7 +481,7 @@ |
425 | |
426 | CB_CHECK_PYRETVAL(ret); |
427 | |
428 | - *name = apr_pstrdup(pool, PyString_AsString(ret)); |
429 | + *name = apr_pstrdup(pool, _PyUnicode_AsString(ret)); |
430 | Py_DECREF(ret); |
431 | |
432 | PyGILState_Release(state); |
433 | @@ -495,7 +495,6 @@ |
434 | { |
435 | RemoteAccessObject *self = (RemoteAccessObject *)callback; |
436 | PyObject *ret; |
437 | - apr_status_t status; |
438 | PyGILState_STATE state; |
439 | |
440 | if (self->open_tmp_file_func == Py_None) { |
441 | @@ -518,32 +517,12 @@ |
442 | |
443 | CB_CHECK_PYRETVAL(ret); |
444 | |
445 | - if (PyString_Check(ret)) { |
446 | - char* fname = PyString_AsString(ret); |
447 | - status = apr_file_open(fp, fname, APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT, |
448 | - pool); |
449 | - if (status) { |
450 | - PyErr_SetAprStatus(status); |
451 | - Py_DECREF(ret); |
452 | - PyGILState_Release(state); |
453 | - return py_svn_error(); |
454 | - } |
455 | - Py_DECREF(ret); |
456 | - } else if (PyFile_Check(ret)) { |
457 | - *fp = apr_file_from_object(ret, pool); |
458 | - Py_DECREF(ret); |
459 | - if (!*fp) { |
460 | - PyGILState_Release(state); |
461 | - return py_svn_error(); |
462 | - } |
463 | - } else { |
464 | - PyErr_SetString(PyExc_TypeError, "Unknown type for file variable"); |
465 | - Py_DECREF(ret); |
466 | - PyGILState_Release(state); |
467 | + *fp = apr_file_from_object(ret, pool); |
468 | + Py_DECREF(ret); |
469 | + PyGILState_Release(state); |
470 | + if (!*fp) { |
471 | return py_svn_error(); |
472 | } |
473 | - |
474 | - PyGILState_Release(state); |
475 | return NULL; |
476 | } |
477 | |
478 | @@ -576,7 +555,7 @@ |
479 | svn_error_t *err; |
480 | |
481 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|OOOOOz", kwnames, &url, |
482 | - &progress_cb, (PyObject **)&auth, &config, |
483 | + &progress_cb, (PyObject **)&auth, &config, |
484 | &client_string_func, &open_tmp_file_func, |
485 | &uuid)) |
486 | return NULL; |
487 | @@ -683,7 +662,7 @@ |
488 | #else |
489 | RUN_RA_WITH_POOL(temp_pool, ra, svn_ra_get_uuid(ra->ra, &uuid, temp_pool)); |
490 | #endif |
491 | - ret = PyString_FromString(uuid); |
492 | + ret = PyUnicode_FromString(uuid); |
493 | apr_pool_destroy(temp_pool); |
494 | return ret; |
495 | } |
496 | @@ -728,7 +707,7 @@ |
497 | RUN_RA_WITH_POOL(temp_pool, ra, |
498 | svn_ra_get_latest_revnum(ra->ra, &latest_revnum, temp_pool)); |
499 | apr_pool_destroy(temp_pool); |
500 | - return PyInt_FromLong(latest_revnum); |
501 | + return PyLong_FromLong(latest_revnum); |
502 | } |
503 | |
504 | static PyObject *ra_get_log(PyObject *self, PyObject *args, PyObject *kwargs) |
505 | @@ -780,7 +759,7 @@ |
506 | } else { |
507 | int i; |
508 | for (i = 0; i < PySequence_Size(revprops); i++) { |
509 | - const char *n = PyString_AsString(PySequence_GetItem(revprops, i)); |
510 | + const char *n = _PyUnicode_AsString(PySequence_GetItem(revprops, i)); |
511 | if (strcmp(SVN_PROP_REVISION_LOG, n) && |
512 | strcmp(SVN_PROP_REVISION_AUTHOR, n) && |
513 | strcmp(SVN_PROP_REVISION_DATE, n)) { |
514 | @@ -850,7 +829,7 @@ |
515 | apr_pool_destroy(temp_pool); |
516 | } |
517 | |
518 | - return PyString_FromString(ra->root); |
519 | + return PyUnicode_FromString(ra->root); |
520 | } |
521 | |
522 | /** |
523 | @@ -872,7 +851,7 @@ |
524 | RUN_RA_WITH_POOL(temp_pool, ra, |
525 | svn_ra_get_session_url(ra->ra, &url, temp_pool)); |
526 | |
527 | - r = PyString_FromString(url); |
528 | + r = PyUnicode_FromString(url); |
529 | |
530 | apr_pool_destroy(temp_pool); |
531 | |
532 | @@ -1248,8 +1227,8 @@ |
533 | PyObject *k, *v; |
534 | hash_lock_tokens = apr_hash_make(pool); |
535 | while (PyDict_Next(lock_tokens, &idx, &k, &v)) { |
536 | - apr_hash_set(hash_lock_tokens, PyString_AsString(k), |
537 | - PyString_Size(k), PyString_AsString(v)); |
538 | + apr_hash_set(hash_lock_tokens, _PyUnicode_AsString(k), |
539 | + PyUnicode_GetSize(k), _PyUnicode_AsString(v)); |
540 | } |
541 | } |
542 | |
543 | @@ -1296,7 +1275,7 @@ |
544 | return NULL; |
545 | } |
546 | |
547 | - if (!PyString_Check(py_log_msg)) { |
548 | + if (!PyUnicode_Check(py_log_msg)) { |
549 | PyErr_SetString(PyExc_ValueError, "svn:log property should be set to string."); |
550 | apr_pool_destroy(pool); |
551 | Py_DECREF(commit_callback); |
552 | @@ -1307,7 +1286,7 @@ |
553 | Py_BEGIN_ALLOW_THREADS |
554 | err = svn_ra_get_commit_editor2(ra->ra, &editor, |
555 | &edit_baton, |
556 | - PyString_AsString(py_log_msg), py_commit_callback, |
557 | + _PyUnicode_AsString(py_log_msg), py_commit_callback, |
558 | commit_callback, hash_lock_tokens, keep_locks, pool); |
559 | #endif |
560 | Py_END_ALLOW_THREADS |
561 | @@ -1414,7 +1393,7 @@ |
562 | pykey = Py_None; |
563 | Py_INCREF(pykey); |
564 | } else { |
565 | - pykey = PyString_FromString((char *)key); |
566 | + pykey = PyUnicode_FromString((char *)key); |
567 | } |
568 | if (PyDict_SetItem(py_dirents, pykey, item) != 0) { |
569 | Py_DECREF(py_dirents); |
570 | @@ -1525,7 +1504,7 @@ |
571 | svn_ra_check_path(ra->ra, svn_path_canonicalize(path, temp_pool), revision, &kind, |
572 | temp_pool)); |
573 | apr_pool_destroy(temp_pool); |
574 | - return PyInt_FromLong(kind); |
575 | + return PyLong_FromLong(kind); |
576 | } |
577 | |
578 | static PyObject *ra_stat(PyObject *self, PyObject *args) |
579 | @@ -1603,7 +1582,7 @@ |
580 | return NULL; |
581 | hash_path_tokens = apr_hash_make(temp_pool); |
582 | while (PyDict_Next(path_tokens, &idx, &k, &v)) { |
583 | - apr_hash_set(hash_path_tokens, PyString_AsString(k), PyString_Size(k), (char *)PyString_AsString(v)); |
584 | + apr_hash_set(hash_path_tokens, _PyUnicode_AsString(k), PyUnicode_GetSize(k), (char *)_PyUnicode_AsString(v)); |
585 | } |
586 | RUN_RA_WITH_POOL(temp_pool, ra, svn_ra_unlock(ra->ra, hash_path_tokens, break_lock, |
587 | py_lock_func, lock_func, temp_pool)); |
588 | @@ -1642,12 +1621,12 @@ |
589 | |
590 | while (PyDict_Next(path_revs, &idx, &k, &v)) { |
591 | rev = (svn_revnum_t *)apr_palloc(temp_pool, sizeof(svn_revnum_t)); |
592 | - *rev = PyInt_AsLong(v); |
593 | + *rev = PyLong_AsLong(v); |
594 | if (*rev == -1 && PyErr_Occurred()) { |
595 | apr_pool_destroy(temp_pool); |
596 | return NULL; |
597 | } |
598 | - apr_hash_set(hash_path_revs, PyString_AsString(k), PyString_Size(k), |
599 | + apr_hash_set(hash_path_revs, _PyUnicode_AsString(k), PyUnicode_GetSize(k), |
600 | rev); |
601 | } |
602 | RUN_RA_WITH_POOL(temp_pool, ra, svn_ra_lock(ra->ra, hash_path_revs, comment, steal_lock, |
603 | @@ -1751,7 +1730,7 @@ |
604 | for (idx = apr_hash_first(temp_pool, hash_locations); idx != NULL; |
605 | idx = apr_hash_next(idx)) { |
606 | apr_hash_this(idx, (const void **)&key, &klen, (void **)&val); |
607 | - if (PyDict_SetItem(ret, PyInt_FromLong(*key), PyString_FromString(val)) != 0) { |
608 | + if (PyDict_SetItem(ret, PyLong_FromLong(*key), PyUnicode_FromString(val)) != 0) { |
609 | Py_DECREF(ret); |
610 | apr_pool_destroy(temp_pool); |
611 | return NULL; |
612 | @@ -2003,7 +1982,7 @@ |
613 | static PyObject *ra_repr(PyObject *self) |
614 | { |
615 | RemoteAccessObject *ra = (RemoteAccessObject *)self; |
616 | - return PyString_FromFormat("RemoteAccess(\"%s\")", ra->url); |
617 | + return PyUnicode_FromFormat("RemoteAccess(\"%s\")", ra->url); |
618 | } |
619 | |
620 | static int ra_set_progress_func(PyObject *self, PyObject *value, void *closure) |
621 | @@ -2117,7 +2096,7 @@ |
622 | }; |
623 | |
624 | static PyTypeObject RemoteAccess_Type = { |
625 | - PyObject_HEAD_INIT(NULL) 0, |
626 | + PyVarObject_HEAD_INIT(NULL, 0) |
627 | "_ra.RemoteAccess", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
628 | sizeof(RemoteAccessObject), |
629 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
630 | @@ -2204,7 +2183,7 @@ |
631 | } |
632 | |
633 | static PyTypeObject AuthProvider_Type = { |
634 | - PyObject_HEAD_INIT(NULL) 0, |
635 | + PyVarObject_HEAD_INIT(NULL, 0) |
636 | "_ra.AuthProvider", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
637 | sizeof(AuthProviderObject), |
638 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
639 | @@ -2281,14 +2260,14 @@ |
640 | return NULL; |
641 | |
642 | if (!strcmp(name, SVN_AUTH_PARAM_SSL_SERVER_FAILURES)) { |
643 | - long ret = PyInt_AsLong(value); |
644 | + long ret = PyLong_AsLong(value); |
645 | if (ret == -1 && PyErr_Occurred()) |
646 | return NULL; |
647 | vvalue = apr_pcalloc(auth->pool, sizeof(apr_uint32_t)); |
648 | *((apr_uint32_t *)vvalue) = ret; |
649 | } else if (!strcmp(name, SVN_AUTH_PARAM_DEFAULT_USERNAME) || |
650 | !strcmp(name, SVN_AUTH_PARAM_DEFAULT_PASSWORD)) { |
651 | - vvalue = apr_pstrdup(auth->pool, PyString_AsString(value)); |
652 | + vvalue = apr_pstrdup(auth->pool, _PyUnicode_AsString(value)); |
653 | } else { |
654 | PyErr_Format(PyExc_TypeError, "Unsupported auth parameter %s", name); |
655 | return NULL; |
656 | @@ -2311,10 +2290,10 @@ |
657 | value = svn_auth_get_parameter(auth->auth_baton, name); |
658 | |
659 | if (!strcmp(name, SVN_AUTH_PARAM_SSL_SERVER_FAILURES)) { |
660 | - return PyInt_FromLong(*((apr_uint32_t *)value)); |
661 | + return PyLong_FromLong(*((apr_uint32_t *)value)); |
662 | } else if (!strcmp(name, SVN_AUTH_PARAM_DEFAULT_USERNAME) || |
663 | !strcmp(name, SVN_AUTH_PARAM_DEFAULT_PASSWORD)) { |
664 | - return PyString_FromString((const char *)value); |
665 | + return PyUnicode_FromString((const char *)value); |
666 | } else { |
667 | PyErr_Format(PyExc_TypeError, "Unsupported auth parameter %s", name); |
668 | return NULL; |
669 | @@ -2404,7 +2383,7 @@ |
670 | } |
671 | |
672 | static PyTypeObject CredentialsIter_Type = { |
673 | - PyObject_HEAD_INIT(NULL) 0, |
674 | + PyVarObject_HEAD_INIT(NULL, 0) |
675 | "_ra.CredentialsIter", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
676 | sizeof(CredentialsIterObject), |
677 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
678 | @@ -2482,7 +2461,7 @@ |
679 | } |
680 | |
681 | static PyTypeObject Auth_Type = { |
682 | - PyObject_HEAD_INIT(NULL) 0, |
683 | + PyVarObject_HEAD_INIT(NULL, 0) |
684 | "_ra.Auth", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
685 | sizeof(AuthObject), |
686 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
687 | @@ -2586,14 +2565,14 @@ |
688 | } |
689 | py_username = PyTuple_GetItem(ret, 0); |
690 | CB_CHECK_PYRETVAL(py_username); |
691 | - if (!PyString_Check(py_username)) { |
692 | + if (!PyUnicode_Check(py_username)) { |
693 | PyErr_SetString(PyExc_TypeError, "username should be string"); |
694 | PyGILState_Release(state); |
695 | return py_svn_error(); |
696 | } |
697 | |
698 | *cred = apr_pcalloc(pool, sizeof(**cred)); |
699 | - (*cred)->username = apr_pstrdup(pool, PyString_AsString(py_username)); |
700 | + (*cred)->username = apr_pstrdup(pool, _PyUnicode_AsString(py_username)); |
701 | (*cred)->may_save = (py_may_save == Py_True); |
702 | Py_DECREF(ret); |
703 | PyGILState_Release(state); |
704 | @@ -2650,7 +2629,7 @@ |
705 | |
706 | py_username = PyTuple_GetItem(ret, 0); |
707 | CB_CHECK_PYRETVAL(py_username); |
708 | - if (!PyString_Check(py_username)) { |
709 | + if (!PyUnicode_Check(py_username)) { |
710 | PyErr_SetString(PyExc_TypeError, "username should be string"); |
711 | PyGILState_Release(state); |
712 | return py_svn_error(); |
713 | @@ -2658,15 +2637,15 @@ |
714 | |
715 | py_password = PyTuple_GetItem(ret, 1); |
716 | CB_CHECK_PYRETVAL(py_password); |
717 | - if (!PyString_Check(py_password)) { |
718 | + if (!PyUnicode_Check(py_password)) { |
719 | PyErr_SetString(PyExc_TypeError, "password should be string"); |
720 | PyGILState_Release(state); |
721 | return py_svn_error(); |
722 | } |
723 | |
724 | *cred = apr_pcalloc(pool, sizeof(**cred)); |
725 | - (*cred)->username = apr_pstrdup(pool, PyString_AsString(py_username)); |
726 | - (*cred)->password = apr_pstrdup(pool, PyString_AsString(py_password)); |
727 | + (*cred)->username = apr_pstrdup(pool, _PyUnicode_AsString(py_username)); |
728 | + (*cred)->password = apr_pstrdup(pool, _PyUnicode_AsString(py_password)); |
729 | (*cred)->may_save = (py_may_save == Py_True); |
730 | Py_DECREF(ret); |
731 | PyGILState_Release(state); |
732 | @@ -2729,7 +2708,7 @@ |
733 | } |
734 | |
735 | py_accepted_failures = PyTuple_GetItem(ret, 0); |
736 | - if (!PyInt_Check(py_accepted_failures)) { |
737 | + if (!PyLong_Check(py_accepted_failures)) { |
738 | Py_DECREF(ret); |
739 | PyErr_SetString(PyExc_TypeError, "accepted_failures should be integer"); |
740 | PyGILState_Release(state); |
741 | @@ -2744,7 +2723,7 @@ |
742 | return py_svn_error(); |
743 | } |
744 | |
745 | - accepted_failures = PyInt_AsLong(py_accepted_failures); |
746 | + accepted_failures = PyLong_AsLong(py_accepted_failures); |
747 | if (accepted_failures == -1 && PyErr_Occurred()) { |
748 | Py_DECREF(ret); |
749 | PyGILState_Release(state); |
750 | @@ -2803,13 +2782,13 @@ |
751 | return py_svn_error(); |
752 | } |
753 | py_password = PyTuple_GetItem(ret, 0); |
754 | - if (!PyString_Check(py_password)) { |
755 | + if (!PyUnicode_Check(py_password)) { |
756 | PyErr_SetString(PyExc_TypeError, "password should be string"); |
757 | PyGILState_Release(state); |
758 | return py_svn_error(); |
759 | } |
760 | *cred = apr_pcalloc(pool, sizeof(**cred)); |
761 | - (*cred)->password = apr_pstrdup(pool, PyString_AsString(py_password)); |
762 | + (*cred)->password = apr_pstrdup(pool, _PyUnicode_AsString(py_password)); |
763 | (*cred)->may_save = (py_may_save == Py_True); |
764 | Py_DECREF(ret); |
765 | PyGILState_Release(state); |
766 | @@ -2842,14 +2821,14 @@ |
767 | } |
768 | |
769 | py_cert_file = PyTuple_GetItem(ret, 0); |
770 | - if (!PyString_Check(py_cert_file)) { |
771 | + if (!PyUnicode_Check(py_cert_file)) { |
772 | PyErr_SetString(PyExc_TypeError, "cert_file should be string"); |
773 | PyGILState_Release(state); |
774 | return py_svn_error(); |
775 | } |
776 | |
777 | *cred = apr_pcalloc(pool, sizeof(**cred)); |
778 | - (*cred)->cert_file = apr_pstrdup(pool, PyString_AsString(py_cert_file)); |
779 | + (*cred)->cert_file = apr_pstrdup(pool, _PyUnicode_AsString(py_cert_file)); |
780 | (*cred)->may_save = (py_may_save == Py_True); |
781 | Py_DECREF(ret); |
782 | PyGILState_Release(state); |
783 | @@ -3042,7 +3021,7 @@ |
784 | apr_pool_destroy(pool); |
785 | return NULL; |
786 | } |
787 | - ret = PyString_FromStringAndSize(string->data, string->len); |
788 | + ret = PyUnicode_FromStringAndSize(string->data, string->len); |
789 | apr_pool_destroy(pool); |
790 | return ret; |
791 | } |
792 | @@ -3217,51 +3196,51 @@ |
793 | { NULL, } |
794 | }; |
795 | |
796 | -void init_ra(void) |
797 | +PyModule_Init_DEFINE(_ra) |
798 | { |
799 | static apr_pool_t *pool; |
800 | - PyObject *mod; |
801 | + PyObject *mod = NULL; |
802 | |
803 | if (PyType_Ready(&RemoteAccess_Type) < 0) |
804 | - return; |
805 | + PyModule_RETURN(mod); |
806 | |
807 | if (PyType_Ready(&Editor_Type) < 0) |
808 | - return; |
809 | + PyModule_RETURN(mod); |
810 | |
811 | if (PyType_Ready(&FileEditor_Type) < 0) |
812 | - return; |
813 | + PyModule_RETURN(mod); |
814 | |
815 | if (PyType_Ready(&DirectoryEditor_Type) < 0) |
816 | - return; |
817 | + PyModule_RETURN(mod); |
818 | |
819 | if (PyType_Ready(&Reporter_Type) < 0) |
820 | - return; |
821 | + PyModule_RETURN(mod); |
822 | |
823 | if (PyType_Ready(&TxDeltaWindowHandler_Type) < 0) |
824 | - return; |
825 | + PyModule_RETURN(mod); |
826 | |
827 | if (PyType_Ready(&Auth_Type) < 0) |
828 | - return; |
829 | + PyModule_RETURN(mod); |
830 | |
831 | if (PyType_Ready(&CredentialsIter_Type) < 0) |
832 | - return; |
833 | + PyModule_RETURN(mod); |
834 | |
835 | if (PyType_Ready(&AuthProvider_Type) < 0) |
836 | - return; |
837 | + PyModule_RETURN(mod); |
838 | |
839 | if (PyType_Ready(&LogIterator_Type) < 0) |
840 | - return; |
841 | + PyModule_RETURN(mod); |
842 | |
843 | apr_initialize(); |
844 | pool = Pool(NULL); |
845 | if (pool == NULL) |
846 | - return; |
847 | + PyModule_RETURN(mod); |
848 | svn_ra_initialize(pool); |
849 | PyEval_InitThreads(); |
850 | |
851 | - mod = Py_InitModule3("_ra", ra_module_methods, "Remote Access"); |
852 | + PyModule_DEFINE(mod, "_ra", "Remote Access", ra_module_methods) |
853 | if (mod == NULL) |
854 | - return; |
855 | + PyModule_RETURN(mod); |
856 | |
857 | PyModule_AddObject(mod, "RemoteAccess", (PyObject *)&RemoteAccess_Type); |
858 | Py_INCREF(&RemoteAccess_Type); |
859 | @@ -3301,4 +3280,5 @@ |
860 | #ifdef SVN_VER_REVISION |
861 | PyModule_AddIntConstant(mod, "SVN_REVISION", SVN_VER_REVISION); |
862 | #endif |
863 | + PyModule_RETURN(mod); |
864 | } |
865 | |
866 | === modified file 'subvertpy/_ra_iter_log.c' |
867 | --- subvertpy/_ra_iter_log.c 2011-06-19 13:04:55 +0000 |
868 | +++ subvertpy/_ra_iter_log.c 2012-04-07 06:08:21 +0000 |
869 | @@ -114,7 +114,7 @@ |
870 | } |
871 | |
872 | PyTypeObject LogIterator_Type = { |
873 | - PyObject_HEAD_INIT(NULL) 0, |
874 | + PyVarObject_HEAD_INIT(NULL, 0) |
875 | "_ra.LogIterator", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
876 | sizeof(LogIteratorObject), |
877 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
878 | @@ -243,17 +243,17 @@ |
879 | } |
880 | |
881 | if (message != NULL) { |
882 | - obj = PyString_FromString(message); |
883 | + obj = PyUnicode_FromString(message); |
884 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_LOG, obj); |
885 | Py_DECREF(obj); |
886 | } |
887 | if (author != NULL) { |
888 | - obj = PyString_FromString(author); |
889 | + obj = PyUnicode_FromString(author); |
890 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_AUTHOR, obj); |
891 | Py_DECREF(obj); |
892 | } |
893 | if (date != NULL) { |
894 | - obj = PyString_FromString(date); |
895 | + obj = PyUnicode_FromString(date); |
896 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_DATE, |
897 | obj); |
898 | Py_DECREF(obj); |
899 | |
900 | === modified file 'subvertpy/client.c' |
901 | --- subvertpy/client.c 2012-03-12 17:27:31 +0000 |
902 | +++ subvertpy/client.c 2012-04-07 06:08:21 +0000 |
903 | @@ -75,17 +75,17 @@ |
904 | |
905 | static bool to_opt_revision(PyObject *arg, svn_opt_revision_t *ret) |
906 | { |
907 | - if (PyInt_Check(arg) || PyLong_Check(arg)) { |
908 | + if (PyLong_Check(arg)) { |
909 | ret->kind = svn_opt_revision_number; |
910 | - ret->value.number = PyInt_AsLong(arg); |
911 | + ret->value.number = PyLong_AsLong(arg); |
912 | if (ret->value.number == -1 && PyErr_Occurred()) |
913 | return false; |
914 | return true; |
915 | } else if (arg == Py_None) { |
916 | ret->kind = svn_opt_revision_unspecified; |
917 | return true; |
918 | - } else if (PyString_Check(arg)) { |
919 | - char *text = PyString_AsString(arg); |
920 | + } else if (PyUnicode_Check(arg)) { |
921 | + char *text = _PyUnicode_AsString(arg); |
922 | if (!strcmp(text, "HEAD")) { |
923 | ret->kind = svn_opt_revision_head; |
924 | return true; |
925 | @@ -293,10 +293,10 @@ |
926 | py_log_msg = ret; |
927 | } |
928 | if (py_log_msg != Py_None) { |
929 | - *log_msg = PyString_AsString(py_log_msg); |
930 | + *log_msg = _PyUnicode_AsString(py_log_msg); |
931 | } |
932 | if (py_tmp_file != Py_None) { |
933 | - *tmp_file = PyString_AsString(py_tmp_file); |
934 | + *tmp_file = _PyUnicode_AsString(py_tmp_file); |
935 | } |
936 | Py_DECREF(ret); |
937 | PyGILState_Release(state); |
938 | @@ -546,7 +546,7 @@ |
939 | return NULL; |
940 | #if ONLY_SINCE_SVN(1, 5) |
941 | RUN_SVN_WITH_POOL(temp_pool, svn_client_checkout3(&result_rev, url, |
942 | - svn_path_canonicalize(path, temp_pool), |
943 | + svn_dirent_internal_style(path, temp_pool), |
944 | &c_peg_rev, &c_rev, recurse?svn_depth_infinity:svn_depth_files, |
945 | ignore_externals, allow_unver_obstructions, client->client, temp_pool)); |
946 | #else |
947 | @@ -558,7 +558,7 @@ |
948 | } |
949 | |
950 | RUN_SVN_WITH_POOL(temp_pool, svn_client_checkout2(&result_rev, url, |
951 | - svn_path_canonicalize(path, temp_pool), |
952 | + svn_dirent_internal_style(path, temp_pool), |
953 | &c_peg_rev, &c_rev, recurse, |
954 | ignore_externals, client->client, temp_pool)); |
955 | #endif |
956 | @@ -655,13 +655,13 @@ |
957 | return NULL; |
958 | #if ONLY_SINCE_SVN(1, 5) |
959 | RUN_SVN_WITH_POOL(temp_pool, svn_client_export4(&result_rev, from, |
960 | - svn_path_canonicalize(to, temp_pool), |
961 | + svn_dirent_internal_style(to, temp_pool), |
962 | &c_peg_rev, &c_rev, overwrite, ignore_externals, |
963 | recurse?svn_depth_infinity:svn_depth_files, |
964 | native_eol, client->client, temp_pool)); |
965 | #else |
966 | RUN_SVN_WITH_POOL(temp_pool, svn_client_export3(&result_rev, from, |
967 | - svn_path_canonicalize(to, temp_pool), |
968 | + svn_dirent_internal_style(to, temp_pool), |
969 | &c_peg_rev, &c_rev, overwrite, ignore_externals, recurse, |
970 | native_eol, client->client, temp_pool)); |
971 | #endif |
972 | @@ -1280,7 +1280,6 @@ |
973 | apr_array_header_t *c_diffopts; |
974 | PyObject *outfile, *errfile; |
975 | apr_file_t *c_outfile, *c_errfile; |
976 | - apr_off_t offset; |
977 | |
978 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|zzzOsbbb:diff", kwnames, |
979 | &rev1, &rev2, &path1, &path2, |
980 | @@ -1313,34 +1312,18 @@ |
981 | } |
982 | Py_DECREF(diffopts); |
983 | |
984 | - outfile = PyOS_tmpfile(); |
985 | + outfile = PyOS_tmpfile(&c_outfile, temp_pool); |
986 | if (outfile == NULL) { |
987 | apr_pool_destroy(temp_pool); |
988 | return NULL; |
989 | } |
990 | - errfile = PyOS_tmpfile(); |
991 | + errfile = PyOS_tmpfile(&c_errfile, temp_pool); |
992 | if (errfile == NULL) { |
993 | apr_pool_destroy(temp_pool); |
994 | Py_DECREF(outfile); |
995 | return NULL; |
996 | } |
997 | |
998 | - c_outfile = apr_file_from_object(outfile, temp_pool); |
999 | - if (c_outfile == NULL) { |
1000 | - apr_pool_destroy(temp_pool); |
1001 | - Py_DECREF(outfile); |
1002 | - Py_DECREF(errfile); |
1003 | - return NULL; |
1004 | - } |
1005 | - |
1006 | - c_errfile = apr_file_from_object(errfile, temp_pool); |
1007 | - if (c_errfile == NULL) { |
1008 | - apr_pool_destroy(temp_pool); |
1009 | - Py_DECREF(outfile); |
1010 | - Py_DECREF(errfile); |
1011 | - return NULL; |
1012 | - } |
1013 | - |
1014 | RUN_SVN_WITH_POOL(temp_pool, |
1015 | svn_client_diff4(c_diffopts, |
1016 | path1, &c_rev1, path2, &c_rev2, |
1017 | @@ -1350,10 +1333,6 @@ |
1018 | c_outfile, c_errfile, NULL, |
1019 | client->client, temp_pool)); |
1020 | |
1021 | - offset = 0; |
1022 | - apr_file_seek(c_outfile, APR_SET, &offset); |
1023 | - offset = 0; |
1024 | - apr_file_seek(c_errfile, APR_SET, &offset); |
1025 | |
1026 | apr_pool_destroy(temp_pool); |
1027 | |
1028 | @@ -1601,7 +1580,7 @@ |
1029 | RUN_SVN_WITH_POOL(pool, svn_wc_get_default_ignores(&patterns, configobj->config, pool)); |
1030 | ret = PyList_New(patterns->nelts); |
1031 | for (i = 0; i < patterns->nelts; i++) { |
1032 | - PyObject *item = PyString_FromString(APR_ARRAY_IDX(patterns, i, char *)); |
1033 | + PyObject *item = PyUnicode_FromString(APR_ARRAY_IDX(patterns, i, char *)); |
1034 | if (item == NULL) { |
1035 | apr_pool_destroy(pool); |
1036 | Py_DECREF(item); |
1037 | @@ -1634,7 +1613,7 @@ |
1038 | } |
1039 | |
1040 | PyTypeObject Config_Type = { |
1041 | - PyObject_HEAD_INIT(NULL) 0, |
1042 | + PyVarObject_HEAD_INIT(NULL, 0) |
1043 | "client.Config", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1044 | sizeof(ConfigObject), /* tp_basicsize */ |
1045 | 0, /* tp_itemsize; For allocation */ |
1046 | @@ -1702,7 +1681,7 @@ |
1047 | } |
1048 | |
1049 | PyTypeObject ConfigItem_Type = { |
1050 | - PyObject_HEAD_INIT(NULL) 0, |
1051 | + PyVarObject_HEAD_INIT(NULL, 0) |
1052 | "client.ConfigItem", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1053 | sizeof(ConfigItemObject), |
1054 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1055 | @@ -1756,7 +1735,7 @@ |
1056 | }; |
1057 | |
1058 | PyTypeObject Info_Type = { |
1059 | - PyObject_HEAD_INIT(NULL) 0, |
1060 | + PyVarObject_HEAD_INIT(NULL, 0) |
1061 | "client.Info", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1062 | sizeof(InfoObject), |
1063 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1064 | @@ -1856,7 +1835,7 @@ |
1065 | } |
1066 | |
1067 | PyTypeObject WCInfo_Type = { |
1068 | - PyObject_HEAD_INIT(NULL) 0, |
1069 | + PyVarObject_HEAD_INIT(NULL, 0) |
1070 | "client.Info", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1071 | sizeof(WCInfoObject), |
1072 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1073 | @@ -1918,7 +1897,7 @@ |
1074 | }; |
1075 | |
1076 | PyTypeObject Client_Type = { |
1077 | - PyObject_HEAD_INIT(NULL) 0, |
1078 | + PyVarObject_HEAD_INIT(NULL, 0) |
1079 | /* PyObject_VAR_HEAD */ |
1080 | "client.Client", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1081 | sizeof(ClientObject), |
1082 | @@ -2054,44 +2033,45 @@ |
1083 | { NULL } |
1084 | }; |
1085 | |
1086 | -void initclient(void) |
1087 | +PyModule_Init_DEFINE(client) |
1088 | { |
1089 | - PyObject *mod; |
1090 | - |
1091 | - if (PyType_Ready(&Client_Type) < 0) |
1092 | - return; |
1093 | - |
1094 | - if (PyType_Ready(&Config_Type) < 0) |
1095 | - return; |
1096 | - |
1097 | - if (PyType_Ready(&ConfigItem_Type) < 0) |
1098 | - return; |
1099 | + PyObject *mod = NULL; |
1100 | + |
1101 | + if (PyType_Ready(&Client_Type) < 0) |
1102 | + PyModule_RETURN(mod); |
1103 | + |
1104 | + if (PyType_Ready(&Config_Type) < 0) |
1105 | + PyModule_RETURN(mod); |
1106 | + |
1107 | + if (PyType_Ready(&ConfigItem_Type) < 0) |
1108 | + PyModule_RETURN(mod); |
1109 | |
1110 | if (PyType_Ready(&Info_Type) < 0) |
1111 | - return; |
1112 | + PyModule_RETURN(mod); |
1113 | |
1114 | if (PyType_Ready(&WCInfo_Type) < 0) |
1115 | - return; |
1116 | + PyModule_RETURN(mod); |
1117 | |
1118 | /* Make sure APR is initialized */ |
1119 | apr_initialize(); |
1120 | |
1121 | - mod = Py_InitModule3("client", client_mod_methods, "Client methods"); |
1122 | - if (mod == NULL) |
1123 | - return; |
1124 | - |
1125 | - Py_INCREF(&Client_Type); |
1126 | - PyModule_AddObject(mod, "Client", (PyObject *)&Client_Type); |
1127 | - |
1128 | - PyModule_AddObject(mod, "depth_empty", |
1129 | - (PyObject *)PyLong_FromLong(svn_depth_empty)); |
1130 | - PyModule_AddObject(mod, "depth_files", |
1131 | - (PyObject *)PyLong_FromLong(svn_depth_files)); |
1132 | - PyModule_AddObject(mod, "depth_immediates", |
1133 | - (PyObject *)PyLong_FromLong(svn_depth_immediates)); |
1134 | - PyModule_AddObject(mod, "depth_infinity", |
1135 | - (PyObject *)PyLong_FromLong(svn_depth_infinity)); |
1136 | + PyModule_DEFINE(mod, "client", "Client methods", client_mod_methods) |
1137 | + if (mod == NULL) |
1138 | + PyModule_RETURN(mod); |
1139 | + |
1140 | + Py_INCREF(&Client_Type); |
1141 | + PyModule_AddObject(mod, "Client", (PyObject *)&Client_Type); |
1142 | + |
1143 | + PyModule_AddObject(mod, "depth_empty", |
1144 | + (PyObject *)PyLong_FromLong(svn_depth_empty)); |
1145 | + PyModule_AddObject(mod, "depth_files", |
1146 | + (PyObject *)PyLong_FromLong(svn_depth_files)); |
1147 | + PyModule_AddObject(mod, "depth_immediates", |
1148 | + (PyObject *)PyLong_FromLong(svn_depth_immediates)); |
1149 | + PyModule_AddObject(mod, "depth_infinity", |
1150 | + (PyObject *)PyLong_FromLong(svn_depth_infinity)); |
1151 | |
1152 | Py_INCREF(&Config_Type); |
1153 | PyModule_AddObject(mod, "Config", (PyObject *)&Config_Type); |
1154 | + PyModule_RETURN(mod); |
1155 | } |
1156 | |
1157 | === modified file 'subvertpy/delta.py' |
1158 | --- subvertpy/delta.py 2010-12-06 16:46:21 +0000 |
1159 | +++ subvertpy/delta.py 2012-04-07 06:08:21 +0000 |
1160 | @@ -38,8 +38,7 @@ |
1161 | |
1162 | DELTA_WINDOW_SIZE = 102400 |
1163 | |
1164 | -def apply_txdelta_window(sbuf, |
1165 | - (sview_offset, sview_len, tview_len, src_ops, ops, new_data)): |
1166 | +def apply_txdelta_window(sbuf, xxx_todo_changeme): |
1167 | """Apply a txdelta window to a buffer. |
1168 | |
1169 | :param sbuf: Source buffer (as bytestring) |
1170 | @@ -51,6 +50,7 @@ |
1171 | :param new_data: Buffer with possible new data |
1172 | :return: Target buffer |
1173 | """ |
1174 | + (sview_offset, sview_len, tview_len, src_ops, ops, new_data) = xxx_todo_changeme |
1175 | sview = sbuf[sview_offset:sview_offset+sview_len] |
1176 | tview = txdelta_apply_ops(src_ops, ops, new_data, sview) |
1177 | if len(tview) != tview_len: |
1178 | @@ -100,7 +100,7 @@ |
1179 | # Copy from source area. |
1180 | tview += sview[offset:offset+length] |
1181 | elif action == TXDELTA_TARGET: |
1182 | - for i in xrange(length): |
1183 | + for i in range(length): |
1184 | tview += tview[offset+i] |
1185 | elif action == TXDELTA_NEW: |
1186 | tview += new_data[offset:offset+length] |
1187 | @@ -117,12 +117,12 @@ |
1188 | :return: MD5 hash over the stream |
1189 | """ |
1190 | hash = md5() |
1191 | - text = stream.read(block_size) |
1192 | - while text != "": |
1193 | + text = stream.read(block_size).encode("utf-8") |
1194 | + while text != b"": |
1195 | hash.update(text) |
1196 | window = (0, 0, len(text), 0, [(TXDELTA_NEW, 0, len(text))], text) |
1197 | handler(window) |
1198 | - text = stream.read(block_size) |
1199 | + text = stream.read(block_size).encode("utf-8") |
1200 | handler(None) |
1201 | return hash.digest() |
1202 | |
1203 | @@ -174,7 +174,7 @@ |
1204 | return ret, text |
1205 | |
1206 | |
1207 | -def pack_svndiff_instruction((action, offset, length)): |
1208 | +def pack_svndiff_instruction(xxx_todo_changeme1): |
1209 | """Pack a SVN diff instruction |
1210 | |
1211 | :param action: Action |
1212 | @@ -182,6 +182,7 @@ |
1213 | :param length: Length |
1214 | :return: encoded text |
1215 | """ |
1216 | + (action, offset, length) = xxx_todo_changeme1 |
1217 | if length < 0x3f: |
1218 | text = chr((action << 6) + length) |
1219 | else: |
1220 | |
1221 | === modified file 'subvertpy/editor.c' |
1222 | --- subvertpy/editor.c 2011-09-19 23:00:08 +0000 |
1223 | +++ subvertpy/editor.c 2012-04-07 06:08:21 +0000 |
1224 | @@ -120,8 +120,9 @@ |
1225 | if (py_new_data == Py_None) { |
1226 | window.new_data = NULL; |
1227 | } else { |
1228 | - new_data.data = PyString_AsString(py_new_data); |
1229 | - new_data.len = PyString_Size(py_new_data); |
1230 | + if (PyBytes_AsStringAndSize(py_new_data, (char**)&new_data.data, (Py_ssize_t *)&new_data.len) < 0) { |
1231 | + return NULL; |
1232 | + } |
1233 | window.new_data = &new_data; |
1234 | } |
1235 | |
1236 | @@ -164,7 +165,7 @@ |
1237 | } |
1238 | |
1239 | PyTypeObject TxDeltaWindowHandler_Type = { |
1240 | - PyObject_HEAD_INIT(NULL) 0, |
1241 | + PyVarObject_HEAD_INIT(NULL, 0) |
1242 | "_ra.TxDeltaWindowHandler", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1243 | sizeof(TxDeltaWindowHandlerObject), |
1244 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1245 | @@ -301,8 +302,8 @@ |
1246 | { NULL } |
1247 | }; |
1248 | |
1249 | -PyTypeObject FileEditor_Type = { |
1250 | - PyObject_HEAD_INIT(NULL) 0, |
1251 | +PyTypeObject FileEditor_Type = { |
1252 | + PyVarObject_HEAD_INIT(NULL, 0) |
1253 | "_ra.FileEditor", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1254 | sizeof(EditorObject), |
1255 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1256 | @@ -676,8 +677,8 @@ |
1257 | { NULL, } |
1258 | }; |
1259 | |
1260 | -PyTypeObject DirectoryEditor_Type = { |
1261 | - PyObject_HEAD_INIT(NULL) 0, |
1262 | +PyTypeObject DirectoryEditor_Type = { |
1263 | + PyVarObject_HEAD_INIT(NULL, 0) |
1264 | "_ra.DirEditor", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1265 | sizeof(EditorObject), |
1266 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1267 | @@ -879,8 +880,8 @@ |
1268 | { NULL } |
1269 | }; |
1270 | |
1271 | -PyTypeObject Editor_Type = { |
1272 | - PyObject_HEAD_INIT(NULL) 0, |
1273 | +PyTypeObject Editor_Type = { |
1274 | + PyVarObject_HEAD_INIT(NULL, 0) |
1275 | "_ra.Editor", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1276 | sizeof(EditorObject), |
1277 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1278 | @@ -1106,7 +1107,7 @@ |
1279 | } |
1280 | } |
1281 | if (window->new_data != NULL && window->new_data->data != NULL) { |
1282 | - py_new_data = PyString_FromStringAndSize(window->new_data->data, |
1283 | + py_new_data = PyBytes_FromStringAndSize(window->new_data->data, |
1284 | window->new_data->len); |
1285 | } else { |
1286 | py_new_data = Py_None; |
1287 | |
1288 | === modified file 'subvertpy/marshall.py' |
1289 | --- subvertpy/marshall.py 2009-02-21 22:11:21 +0000 |
1290 | +++ subvertpy/marshall.py 2012-04-07 06:08:21 +0000 |
1291 | @@ -65,7 +65,7 @@ |
1292 | return "%s " % x |
1293 | elif type(x) is str: |
1294 | return "%d:%s " % (len(x), x) |
1295 | - elif type(x) is unicode: |
1296 | + elif type(x) is str: |
1297 | return "%d:%s " % (len(x), x.encode("utf-8")) |
1298 | elif type(x) is bool: |
1299 | if x == True: |
1300 | |
1301 | === modified file 'subvertpy/properties.py' |
1302 | --- subvertpy/properties.py 2011-01-22 23:37:15 +0000 |
1303 | +++ subvertpy/properties.py 2012-04-07 06:08:21 +0000 |
1304 | @@ -18,7 +18,7 @@ |
1305 | __author__ = "Jelmer Vernooij <jelmer@samba.org>" |
1306 | __docformat__ = "restructuredText" |
1307 | |
1308 | -import bisect, calendar, time, urlparse |
1309 | +import bisect, calendar, time, urllib.parse |
1310 | |
1311 | |
1312 | class InvalidExternalsDescription(Exception): |
1313 | @@ -61,7 +61,7 @@ |
1314 | assert usecstr[-1] == "Z" |
1315 | tm_usec = int(usecstr[:-1]) |
1316 | tm = time.strptime(basestr, "%Y-%m-%dT%H:%M:%S") |
1317 | - return (long(calendar.timegm(tm)) * 1000000 + tm_usec) |
1318 | + return (int(calendar.timegm(tm)) * 1000000 + tm_usec) |
1319 | |
1320 | |
1321 | def parse_externals_description(base_url, val): |
1322 | @@ -117,7 +117,7 @@ |
1323 | raise NotImplementedError("Relative to the scheme externals not yet supported") |
1324 | if relurl.startswith("^/"): |
1325 | raise NotImplementedError("Relative to the repository root externals not yet supported") |
1326 | - ret[path] = (revno, urlparse.urljoin(base_url+"/", relurl)) |
1327 | + ret[path] = (revno, urllib.parse.urljoin(base_url+"/", relurl)) |
1328 | return ret |
1329 | |
1330 | |
1331 | @@ -152,7 +152,8 @@ |
1332 | :param merges: dictionary mapping paths to lists of ranges |
1333 | :return: Property contents |
1334 | """ |
1335 | - def formatrange((start, end, inheritable)): |
1336 | + def formatrange(xxx_todo_changeme): |
1337 | + (start, end, inheritable) = xxx_todo_changeme |
1338 | suffix = "" |
1339 | if not inheritable: |
1340 | suffix = "*" |
1341 | @@ -161,7 +162,7 @@ |
1342 | else: |
1343 | return "%d-%d%s" % (start, end, suffix) |
1344 | text = "" |
1345 | - for (path, ranges) in merges.iteritems(): |
1346 | + for (path, ranges) in merges.items(): |
1347 | assert path.startswith("/") |
1348 | text += "%s:%s\n" % (path, ",".join(map(formatrange, ranges))) |
1349 | return text |
1350 | @@ -279,7 +280,7 @@ |
1351 | with the old and the new property value. |
1352 | """ |
1353 | ret = {} |
1354 | - for key, newval in current.iteritems(): |
1355 | + for key, newval in current.items(): |
1356 | oldval = previous.get(key) |
1357 | if oldval != newval: |
1358 | ret[key] = (oldval, newval) |
1359 | |
1360 | === added file 'subvertpy/py_fixup.h' |
1361 | --- subvertpy/py_fixup.h 1970-01-01 00:00:00 +0000 |
1362 | +++ subvertpy/py_fixup.h 2012-04-07 06:08:21 +0000 |
1363 | @@ -0,0 +1,118 @@ |
1364 | + |
1365 | +#ifndef PY_FIXUP_H |
1366 | +#define PY_FIXUP_H |
1367 | + |
1368 | +/*Macros and functions to ease compatibility with Python 2 and Python 3.*/ |
1369 | + |
1370 | +#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03010000 |
1371 | +#error Python 3.0 is not supported. Please use 3.1 and higher. |
1372 | +#endif |
1373 | + |
1374 | +/*Macros introduced in 2.6, backported for 2.4 and 2.5.*/ |
1375 | +#ifndef PyVarObject_HEAD_INIT |
1376 | +#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, |
1377 | +#endif |
1378 | +#ifndef Py_TYPE |
1379 | +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
1380 | +#endif |
1381 | + |
1382 | +/*Fixup for MSVC inline.*/ |
1383 | +#ifdef _MSC_VER |
1384 | +#define inline __inline |
1385 | +#endif |
1386 | + |
1387 | +/*Used for items that are ANSI in Python 2 and Unicode in Python 3 or in int 2 and long in 3.*/ |
1388 | + |
1389 | +#if PY_MAJOR_VERSION >= 3 |
1390 | + #define PyModule_DEFINE(ob, name, doc, methods) \ |
1391 | + {static struct PyModuleDef module_##ob = { \ |
1392 | + PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \ |
1393 | + ob = PyModule_Create(&module_##ob);} |
1394 | + |
1395 | + #define PyModule_Init_DEFINE(module_name) PyMODINIT_FUNC PyInit_##module_name(void) |
1396 | + #define PyModule_RETURN(v) return (v) |
1397 | + #define PyString_FromString PyUnicode_FromString |
1398 | + #define PyString_FromStringAndSize PyUnicode_FromStringAndSize |
1399 | + #define PyString_Check PyUnicode_Check |
1400 | + #define PyString_Type PyUnicode_Type |
1401 | + #define PyString_Size PyUnicode_Size |
1402 | + #define PyInt_FromLong PyLong_FromLong |
1403 | + #define PyInt_AsLong PyLong_AsLong |
1404 | + #define PyInt_AS_LONG PyLong_AS_LONG |
1405 | + #define PyInt_Type PyLong_Type |
1406 | + #define PyString_FromFormatV PyUnicode_FromFormatV |
1407 | + #define PyString_FromFormat PyUnicode_FromFormat |
1408 | + #define Py_TPFLAGS_HAVE_ITER 0 |
1409 | + |
1410 | + #define PyString_AsString PyUnicode_AsString |
1411 | + |
1412 | + #define PyTEXT_T Py_UNICODE |
1413 | + |
1414 | + #define PyString_Join PyUnicode_Join |
1415 | + |
1416 | +static inline void PyString_ConcatAndDel(PyObject** lhs, PyObject* rhs) |
1417 | +{ |
1418 | + PyUnicode_Concat(*lhs, rhs); |
1419 | + Py_DECREF(rhs); |
1420 | +} |
1421 | + |
1422 | +#else |
1423 | + #include <stringobject.h> |
1424 | + #include <intobject.h> |
1425 | + #include <bufferobject.h> |
1426 | + |
1427 | + #define PyModule_DEFINE(ob, name, doc, methods) \ |
1428 | + ob = Py_InitModule3(name, methods, doc); |
1429 | + |
1430 | + #define PyModule_Init_DEFINE(module_name) void init##module_name(void) |
1431 | + #define PyModule_RETURN(v) |
1432 | + |
1433 | + #define PyTEXT_T char |
1434 | + |
1435 | + #define PyString_Join _PyString_Join |
1436 | + |
1437 | +#endif |
1438 | + |
1439 | +static inline PyObject* PyText_New(Py_ssize_t length) |
1440 | +{ |
1441 | + /*Returns a new, uninitialized String (Python 2) or Unicode object (Python 3) object.*/ |
1442 | +#if PY_MAJOR_VERSION < 3 |
1443 | + return PyString_FromStringAndSize(0, length); |
1444 | +#else |
1445 | + return PyUnicode_FromUnicode(0, length); |
1446 | +#endif |
1447 | +} |
1448 | + |
1449 | +static inline PyTEXT_T* PyText_Buffer(PyObject* o) |
1450 | +{ |
1451 | +#if PY_MAJOR_VERSION < 3 |
1452 | + return PyString_AS_STRING(o); |
1453 | +#else |
1454 | + return PyUnicode_AS_UNICODE(o); |
1455 | +#endif |
1456 | +} |
1457 | + |
1458 | + |
1459 | +static inline bool PyText_Check(PyObject* o) |
1460 | +{ |
1461 | + /*A compatibility function that determines if the object is a string, based on the version of Python. |
1462 | + For Python 2, an ASCII or Unicode string is allowed. For Python 3, it must be a Unicode object.*/ |
1463 | +#if PY_MAJOR_VERSION < 3 |
1464 | + if (o && PyString_Check(o)) |
1465 | + return true; |
1466 | +#endif |
1467 | + return o && PyUnicode_Check(o); |
1468 | +} |
1469 | + |
1470 | + |
1471 | +static inline Py_ssize_t PyText_Size(PyObject* o) |
1472 | +{ |
1473 | +#if PY_MAJOR_VERSION < 3 |
1474 | + if (o && PyString_Check(o)) |
1475 | + return PyString_GET_SIZE(o); |
1476 | +#endif |
1477 | + return (o && PyUnicode_Check(o)) ? PyUnicode_GET_SIZE(o) : 0; |
1478 | +} |
1479 | + |
1480 | + |
1481 | +#endif /*PY_FIXUP_H*/ |
1482 | |
1483 | === modified file 'subvertpy/ra.py' |
1484 | --- subvertpy/ra.py 2009-02-21 22:11:21 +0000 |
1485 | +++ subvertpy/ra.py 2012-04-07 06:08:21 +0000 |
1486 | @@ -19,11 +19,11 @@ |
1487 | |
1488 | from subvertpy import SubversionException, ERR_BAD_URL |
1489 | |
1490 | -import _ra |
1491 | -from _ra import * |
1492 | -import ra_svn |
1493 | +from . import _ra |
1494 | +from ._ra import * |
1495 | +from . import ra_svn |
1496 | |
1497 | -import urllib |
1498 | +import urllib.request, urllib.parse, urllib.error |
1499 | |
1500 | url_handlers = { |
1501 | "svn": _ra.RemoteAccess, |
1502 | @@ -41,7 +41,7 @@ |
1503 | :param url: URL to connect to |
1504 | :return: RemoteAccess object |
1505 | """ |
1506 | - (type, opaque) = urllib.splittype(url) |
1507 | + (type, opaque) = urllib.parse.splittype(url) |
1508 | if not type in url_handlers: |
1509 | raise SubversionException("Unknown URL type '%s'" % type, ERR_BAD_URL) |
1510 | return url_handlers[type](url, *args, **kwargs) |
1511 | |
1512 | === modified file 'subvertpy/ra_svn.py' |
1513 | --- subvertpy/ra_svn.py 2011-01-14 18:42:54 +0000 |
1514 | +++ subvertpy/ra_svn.py 2012-04-07 06:08:21 +0000 |
1515 | @@ -17,12 +17,12 @@ |
1516 | |
1517 | __author__ = "Jelmer Vernooij <jelmer@samba.org>" |
1518 | |
1519 | -import SocketServer |
1520 | +import socketserver |
1521 | import base64 |
1522 | import os |
1523 | import socket |
1524 | import subprocess |
1525 | -import urllib |
1526 | +import urllib.request, urllib.parse, urllib.error |
1527 | |
1528 | from subvertpy import ( |
1529 | ERR_RA_SVN_UNKNOWN_CMD, |
1530 | @@ -419,9 +419,9 @@ |
1531 | def __init__(self, url, progress_cb=None, auth=None, config=None, |
1532 | client_string_func=None, open_tmp_file_func=None): |
1533 | self.url = url |
1534 | - (type, opaque) = urllib.splittype(url) |
1535 | + (type, opaque) = urllib.parse.splittype(url) |
1536 | assert type in ("svn", "svn+ssh") |
1537 | - (host, path) = urllib.splithost(opaque) |
1538 | + (host, path) = urllib.parse.splithost(opaque) |
1539 | self._progress_cb = progress_cb |
1540 | self._auth = auth |
1541 | self._config = config |
1542 | @@ -467,7 +467,7 @@ |
1543 | _recv_ack = _unpack |
1544 | |
1545 | def _connect(self, host): |
1546 | - (host, port) = urllib.splitnport(host, SVN_PORT) |
1547 | + (host, port) = urllib.parse.splitnport(host, SVN_PORT) |
1548 | sockaddrs = socket.getaddrinfo(host, port, socket.AF_UNSPEC, |
1549 | socket.SOCK_STREAM, 0, 0) |
1550 | self._socket = None |
1551 | @@ -475,7 +475,7 @@ |
1552 | try: |
1553 | self._socket = socket.socket(family, socktype, proto) |
1554 | self._socket.connect(sockaddr) |
1555 | - except socket.error, err: |
1556 | + except socket.error as err: |
1557 | if self._socket is not None: |
1558 | self._socket.close() |
1559 | self._socket = None |
1560 | @@ -487,12 +487,12 @@ |
1561 | return (self._socket.recv, self._socket.send) |
1562 | |
1563 | def _connect_ssh(self, host): |
1564 | - (user, host) = urllib.splituser(host) |
1565 | + (user, host) = urllib.parse.splituser(host) |
1566 | if user is not None: |
1567 | (user, password) = urllib.splitpassword(user) |
1568 | else: |
1569 | password = None |
1570 | - (host, port) = urllib.splitnport(host, 22) |
1571 | + (host, port) = urllib.parse.splitnport(host, 22) |
1572 | self._tunnel = get_ssh_vendor().connect_ssh(user, password, host, port, ["svnserve", "-t"]) |
1573 | return (self._tunnel.recv, self._tunnel.send) |
1574 | |
1575 | @@ -643,12 +643,12 @@ |
1576 | keep_locks=False): |
1577 | args = [revprops[properties.PROP_REVISION_LOG]] |
1578 | if lock_tokens is not None: |
1579 | - args.append(lock_tokens.items()) |
1580 | + args.append(list(lock_tokens.items())) |
1581 | else: |
1582 | args.append([]) |
1583 | args.append(keep_locks) |
1584 | if len(revprops) > 1: |
1585 | - args.append(revprops.items()) |
1586 | + args.append(list(revprops.items())) |
1587 | self.send_msg([literal("commit"), args]) |
1588 | self._recv_ack() |
1589 | raise NotImplementedError(self.get_commit_editor) |
1590 | @@ -894,7 +894,7 @@ |
1591 | def send_revision(revno, author, date, message, changed_paths=None): |
1592 | changes = [] |
1593 | if changed_paths is not None: |
1594 | - for p, (action, cf, cr) in changed_paths.iteritems(): |
1595 | + for p, (action, cf, cr) in changed_paths.items(): |
1596 | if cf is not None: |
1597 | changes.append((p, literal(action), (cf, cr))) |
1598 | else: |
1599 | @@ -915,7 +915,7 @@ |
1600 | self.send_success() |
1601 | |
1602 | def open_backend(self, url): |
1603 | - (rooturl, location) = urllib.splithost(url) |
1604 | + (rooturl, location) = urllib.parse.splithost(url) |
1605 | self.repo_backend, self.relpath = self.backend.open_repository(location) |
1606 | |
1607 | def reparent(self, parent): |
1608 | @@ -952,7 +952,7 @@ |
1609 | def rev_proplist(self, revnum): |
1610 | self.send_ack() |
1611 | revprops = self.repo_backend.rev_proplist(revnum) |
1612 | - self.send_success(revprops.items()) |
1613 | + self.send_success(list(revprops.items())) |
1614 | |
1615 | def rev_prop(self, revnum, name): |
1616 | self.send_ack() |
1617 | @@ -965,7 +965,7 @@ |
1618 | def get_locations(self, path, peg_revnum, revnums): |
1619 | self.send_ack() |
1620 | locations = self.repo_backend.get_locations(path, peg_revnum, revnums) |
1621 | - for rev, path in locations.iteritems(): |
1622 | + for rev, path in locations.items(): |
1623 | self.send_msg([rev, path]) |
1624 | self.send_msg(literal("done")) |
1625 | self.send_success() |
1626 | @@ -1047,7 +1047,7 @@ |
1627 | # Expect: |
1628 | while not self._stop: |
1629 | ( cmd, args ) = self.recv_msg() |
1630 | - if not self.commands.has_key(cmd): |
1631 | + if cmd not in self.commands: |
1632 | self.mutter("client used unknown command %r" % cmd) |
1633 | self.send_unknown(cmd) |
1634 | return |
1635 | @@ -1062,11 +1062,11 @@ |
1636 | self._logf.write("%s\n" % text) |
1637 | |
1638 | |
1639 | -class TCPSVNRequestHandler(SocketServer.StreamRequestHandler): |
1640 | +class TCPSVNRequestHandler(socketserver.StreamRequestHandler): |
1641 | |
1642 | def __init__(self, request, client_address, server): |
1643 | self._server = server |
1644 | - SocketServer.StreamRequestHandler.__init__(self, request, |
1645 | + socketserver.StreamRequestHandler.__init__(self, request, |
1646 | client_address, server) |
1647 | |
1648 | def handle(self): |
1649 | @@ -1074,19 +1074,19 @@ |
1650 | self.wfile.write, self._server._logf) |
1651 | try: |
1652 | server.serve() |
1653 | - except socket.error, e: |
1654 | + except socket.error as e: |
1655 | if e.args[0] == 32:# EPIPE |
1656 | return |
1657 | raise |
1658 | |
1659 | |
1660 | -class TCPSVNServer(SocketServer.TCPServer): |
1661 | +class TCPSVNServer(socketserver.TCPServer): |
1662 | |
1663 | allow_reuse_address = True |
1664 | - serve = SocketServer.TCPServer.serve_forever |
1665 | + serve = socketserver.TCPServer.serve_forever |
1666 | |
1667 | def __init__(self, backend, addr, logf=None): |
1668 | self._logf = logf |
1669 | self._backend = backend |
1670 | - SocketServer.TCPServer.__init__(self, addr, TCPSVNRequestHandler) |
1671 | + socketserver.TCPServer.__init__(self, addr, TCPSVNRequestHandler) |
1672 | |
1673 | |
1674 | === modified file 'subvertpy/repos.c' |
1675 | --- subvertpy/repos.c 2011-09-20 21:18:26 +0000 |
1676 | +++ subvertpy/repos.c 2012-04-07 06:08:21 +0000 |
1677 | @@ -62,9 +62,9 @@ |
1678 | PyErr_SetString(PyExc_RuntimeError, "Unable to create fs config hash"); |
1679 | return NULL; |
1680 | } |
1681 | - RUN_SVN_WITH_POOL(pool, svn_repos_create(&repos, |
1682 | - svn_path_canonicalize(path, pool), NULL, NULL, |
1683 | - hash_config, hash_fs_config, pool)); |
1684 | + RUN_SVN_WITH_POOL(pool, svn_repos_create(&repos, |
1685 | + svn_dirent_internal_style(path, pool), NULL, NULL, |
1686 | + hash_config, hash_fs_config, pool)); |
1687 | |
1688 | ret = PyObject_New(RepositoryObject, &Repository_Type); |
1689 | if (ret == NULL) |
1690 | @@ -104,8 +104,8 @@ |
1691 | return NULL; |
1692 | } |
1693 | Py_BEGIN_ALLOW_THREADS |
1694 | - err = svn_repos_open(&ret->repos, svn_path_canonicalize(path, ret->pool), |
1695 | - ret->pool); |
1696 | + err = svn_repos_open(&ret->repos, svn_dirent_internal_style(path, ret->pool), |
1697 | + ret->pool); |
1698 | Py_END_ALLOW_THREADS |
1699 | |
1700 | if (err != NULL) { |
1701 | @@ -165,7 +165,7 @@ |
1702 | if (temp_pool == NULL) |
1703 | return NULL; |
1704 | RUN_SVN_WITH_POOL(temp_pool, svn_fs_get_uuid(fsobj->fs, &uuid, temp_pool)); |
1705 | - ret = PyString_FromString(uuid); |
1706 | + ret = PyUnicode_FromString(uuid); |
1707 | apr_pool_destroy(temp_pool); |
1708 | |
1709 | return ret; |
1710 | @@ -181,7 +181,7 @@ |
1711 | if (temp_pool == NULL) |
1712 | return NULL; |
1713 | RUN_SVN_WITH_POOL(temp_pool, svn_fs_youngest_rev(&rev, self->fs, temp_pool)); |
1714 | - ret = PyInt_FromLong(rev); |
1715 | + ret = PyLong_FromLong(rev); |
1716 | apr_pool_destroy(temp_pool); |
1717 | |
1718 | return ret; |
1719 | @@ -252,7 +252,7 @@ |
1720 | } |
1721 | |
1722 | PyTypeObject FileSystem_Type = { |
1723 | - PyObject_HEAD_INIT(NULL) 0, |
1724 | + PyVarObject_HEAD_INIT(NULL, 0) |
1725 | "repos.FileSystem", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1726 | sizeof(FileSystemObject), |
1727 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1728 | @@ -517,7 +517,7 @@ |
1729 | }; |
1730 | |
1731 | PyTypeObject Repository_Type = { |
1732 | - PyObject_HEAD_INIT(NULL) 0, |
1733 | + PyVarObject_HEAD_INIT(NULL, 0) |
1734 | "repos.Repository", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1735 | sizeof(RepositoryObject), |
1736 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1737 | @@ -607,7 +607,7 @@ |
1738 | apr_pool_destroy(temp_pool); |
1739 | return NULL; |
1740 | } |
1741 | - return PyString_FromStringAndSize(str->data, str->len); |
1742 | + return PyBytes_FromStringAndSize(str->data, str->len); |
1743 | } |
1744 | |
1745 | #if ONLY_BEFORE_SVN(1, 6) |
1746 | @@ -759,7 +759,7 @@ |
1747 | RUN_SVN_WITH_POOL(temp_pool, svn_fs_file_length(&filesize, self->root, |
1748 | path, temp_pool)); |
1749 | apr_pool_destroy(temp_pool); |
1750 | - return PyInt_FromLong(filesize); |
1751 | + return PyLong_FromUnsignedLongLong(filesize); |
1752 | } |
1753 | |
1754 | static PyObject *fs_node_file_proplist(FileSystemRootObject *self, PyObject *args) |
1755 | @@ -812,7 +812,7 @@ |
1756 | ret = Py_None; |
1757 | Py_INCREF(ret); |
1758 | } else { |
1759 | - ret = PyString_FromString(cstr); |
1760 | + ret = PyBytes_FromString(cstr); |
1761 | } |
1762 | #else |
1763 | if (kind > 0) { |
1764 | @@ -823,7 +823,7 @@ |
1765 | RUN_SVN_WITH_POOL(temp_pool, svn_fs_file_md5_checksum(checksum, |
1766 | self->root, |
1767 | path, temp_pool)); |
1768 | - ret = PyString_FromStringAndSize((char *)checksum, APR_MD5_DIGESTSIZE); |
1769 | + ret = PyBytes_FromStringAndSize((char *)checksum, APR_MD5_DIGESTSIZE); |
1770 | #endif |
1771 | apr_pool_destroy(temp_pool); |
1772 | return ret; |
1773 | @@ -868,7 +868,7 @@ |
1774 | }; |
1775 | |
1776 | PyTypeObject FileSystemRoot_Type = { |
1777 | - PyObject_HEAD_INIT(NULL) 0, |
1778 | + PyVarObject_HEAD_INIT(NULL, 0) |
1779 | "repos.FileSystemRoot", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
1780 | sizeof(FileSystemRootObject), |
1781 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
1782 | @@ -928,48 +928,48 @@ |
1783 | }; |
1784 | |
1785 | |
1786 | -void initrepos(void) |
1787 | +PyModule_Init_DEFINE(repos) |
1788 | { |
1789 | static apr_pool_t *pool; |
1790 | - PyObject *mod; |
1791 | + PyObject *mod = NULL; |
1792 | |
1793 | if (PyType_Ready(&Repository_Type) < 0) |
1794 | - return; |
1795 | + PyModule_RETURN(mod); |
1796 | |
1797 | if (PyType_Ready(&FileSystem_Type) < 0) |
1798 | - return; |
1799 | + PyModule_RETURN(mod); |
1800 | |
1801 | if (PyType_Ready(&FileSystemRoot_Type) < 0) |
1802 | - return; |
1803 | + PyModule_RETURN(mod); |
1804 | |
1805 | if (PyType_Ready(&Stream_Type) < 0) |
1806 | - return; |
1807 | + PyModule_RETURN(mod); |
1808 | |
1809 | apr_initialize(); |
1810 | pool = Pool(NULL); |
1811 | if (pool == NULL) |
1812 | - return; |
1813 | + PyModule_RETURN(mod); |
1814 | |
1815 | svn_fs_initialize(pool); |
1816 | |
1817 | - mod = Py_InitModule3("repos", repos_module_methods, "Local repository management"); |
1818 | + PyModule_DEFINE(mod, "repos", "Local repository management", repos_module_methods) |
1819 | if (mod == NULL) |
1820 | - return; |
1821 | + PyModule_RETURN(mod); |
1822 | |
1823 | PyModule_AddObject(mod, "LOAD_UUID_DEFAULT", PyLong_FromLong(svn_repos_load_uuid_default)); |
1824 | PyModule_AddObject(mod, "LOAD_UUID_IGNORE", PyLong_FromLong(svn_repos_load_uuid_ignore)); |
1825 | PyModule_AddObject(mod, "LOAD_UUID_FORCE", PyLong_FromLong(svn_repos_load_uuid_force)); |
1826 | |
1827 | - PyModule_AddObject(mod, "PATH_CHANGE_MODIFY", PyInt_FromLong(svn_fs_path_change_modify)); |
1828 | - PyModule_AddObject(mod, "PATH_CHANGE_ADD", PyInt_FromLong(svn_fs_path_change_add)); |
1829 | - PyModule_AddObject(mod, "PATH_CHANGE_DELETE", PyInt_FromLong(svn_fs_path_change_delete)); |
1830 | - PyModule_AddObject(mod, "PATH_CHANGE_REPLACE", PyInt_FromLong(svn_fs_path_change_replace)); |
1831 | + PyModule_AddObject(mod, "PATH_CHANGE_MODIFY", PyLong_FromLong(svn_fs_path_change_modify)); |
1832 | + PyModule_AddObject(mod, "PATH_CHANGE_ADD", PyLong_FromLong(svn_fs_path_change_add)); |
1833 | + PyModule_AddObject(mod, "PATH_CHANGE_DELETE", PyLong_FromLong(svn_fs_path_change_delete)); |
1834 | + PyModule_AddObject(mod, "PATH_CHANGE_REPLACE", PyLong_FromLong(svn_fs_path_change_replace)); |
1835 | |
1836 | #if ONLY_SINCE_SVN(1, 6) |
1837 | - PyModule_AddObject(mod, "CHECKSUM_MD5", PyInt_FromLong(svn_checksum_md5)); |
1838 | - PyModule_AddObject(mod, "CHECKSUM_SHA1", PyInt_FromLong(svn_checksum_sha1)); |
1839 | + PyModule_AddObject(mod, "CHECKSUM_MD5", PyLong_FromLong(svn_checksum_md5)); |
1840 | + PyModule_AddObject(mod, "CHECKSUM_SHA1", PyLong_FromLong(svn_checksum_sha1)); |
1841 | #else |
1842 | - PyModule_AddObject(mod, "CHECKSUM_MD5", PyInt_FromLong(0)); |
1843 | + PyModule_AddObject(mod, "CHECKSUM_MD5", PyLong_FromLong(0)); |
1844 | #endif |
1845 | |
1846 | PyModule_AddObject(mod, "Repository", (PyObject *)&Repository_Type); |
1847 | @@ -977,4 +977,5 @@ |
1848 | |
1849 | PyModule_AddObject(mod, "Stream", (PyObject *)&Stream_Type); |
1850 | Py_INCREF(&Stream_Type); |
1851 | + PyModule_RETURN(mod); |
1852 | } |
1853 | |
1854 | === modified file 'subvertpy/tests/__init__.py' |
1855 | --- subvertpy/tests/__init__.py 2012-03-12 16:32:02 +0000 |
1856 | +++ subvertpy/tests/__init__.py 2012-04-07 06:08:21 +0000 |
1857 | @@ -19,7 +19,7 @@ |
1858 | __author__ = 'Jelmer Vernooij <jelmer@samba.org>' |
1859 | __docformat__ = 'restructuredText' |
1860 | |
1861 | -from cStringIO import StringIO |
1862 | +from io import StringIO |
1863 | import os |
1864 | import shutil |
1865 | import stat |
1866 | @@ -33,9 +33,8 @@ |
1867 | from unittest2 import SkipTest |
1868 | except ImportError: |
1869 | from testtools.testcase import TestSkipped as SkipTest |
1870 | -import urllib2 |
1871 | -import urllib |
1872 | -import urlparse |
1873 | +import urllib.request, urllib.error, urllib.parse |
1874 | +import urllib.parse |
1875 | |
1876 | from subvertpy import ( |
1877 | client, |
1878 | @@ -160,7 +159,7 @@ |
1879 | def add_dir(self, path, copyfrom_path=None, copyfrom_rev=-1): |
1880 | self.close_children() |
1881 | if copyfrom_path is not None: |
1882 | - copyfrom_path = urlparse.urljoin(self.baseurl+"/", copyfrom_path) |
1883 | + copyfrom_path = urllib.parse.urljoin(self.baseurl+"/", copyfrom_path) |
1884 | if copyfrom_path is not None and copyfrom_rev == -1: |
1885 | copyfrom_rev = self.revnum |
1886 | assert (copyfrom_path is None and copyfrom_rev == -1) or \ |
1887 | @@ -173,7 +172,7 @@ |
1888 | def add_file(self, path, copyfrom_path=None, copyfrom_rev=-1): |
1889 | self.close_children() |
1890 | if copyfrom_path is not None: |
1891 | - copyfrom_path = urlparse.urljoin(self.baseurl+"/", copyfrom_path) |
1892 | + copyfrom_path = urllib.parse.urljoin(self.baseurl+"/", copyfrom_path) |
1893 | if copyfrom_path is not None and copyfrom_rev == -1: |
1894 | copyfrom_rev = self.revnum |
1895 | child = TestFileEditor(self.dir.add_file(path, copyfrom_path, |
1896 | @@ -249,10 +248,10 @@ |
1897 | f.write("#!/bin/sh\n") |
1898 | finally: |
1899 | f.close() |
1900 | - os.chmod(revprop_hook, os.stat(revprop_hook).st_mode | 0111) |
1901 | + os.chmod(revprop_hook, os.stat(revprop_hook).st_mode | 0o111) |
1902 | |
1903 | if sys.platform == 'win32': |
1904 | - return 'file:%s' % urllib.pathname2url(abspath) |
1905 | + return 'file:%s' % urllib.request.pathname2url(abspath) |
1906 | else: |
1907 | return "file://%s" % abspath |
1908 | |
1909 | @@ -277,7 +276,7 @@ |
1910 | if recursive: |
1911 | return ret |
1912 | else: |
1913 | - return ret.values()[0] |
1914 | + return list(ret.values())[0] |
1915 | |
1916 | def client_get_revprop(self, url, revnum, name): |
1917 | """Get the revision property. |
1918 | @@ -379,7 +378,7 @@ |
1919 | :param files: Dictionary with filenames as keys, contents as |
1920 | values. None as value indicates a directory. |
1921 | """ |
1922 | - for name, content in files.iteritems(): |
1923 | + for name, content in files.items(): |
1924 | if content is None: |
1925 | try: |
1926 | os.makedirs(name) |
1927 | @@ -423,7 +422,7 @@ |
1928 | :param message: Commit message |
1929 | :return: Commit editor object |
1930 | """ |
1931 | - ra_ctx = RemoteAccess(url.encode("utf-8"), |
1932 | + ra_ctx = RemoteAccess(url, |
1933 | auth=Auth([ra.get_username_provider()])) |
1934 | revnum = ra_ctx.get_latest_revnum() |
1935 | return TestCommitEditor(ra_ctx.get_commit_editor({"svn:log": message}), |
1936 | |
1937 | === modified file 'subvertpy/tests/test_client.py' |
1938 | --- subvertpy/tests/test_client.py 2012-03-04 20:32:19 +0000 |
1939 | +++ subvertpy/tests/test_client.py 2012-04-07 06:08:21 +0000 |
1940 | @@ -17,7 +17,7 @@ |
1941 | |
1942 | from datetime import datetime, timedelta |
1943 | import os |
1944 | -from StringIO import StringIO |
1945 | +from io import StringIO |
1946 | import shutil |
1947 | import tempfile |
1948 | |
1949 | @@ -37,10 +37,10 @@ |
1950 | class VersionTest(TestCase): |
1951 | |
1952 | def test_version_length(self): |
1953 | - self.assertEquals(4, len(client.version())) |
1954 | + self.assertEqual(4, len(client.version())) |
1955 | |
1956 | def test_api_version_length(self): |
1957 | - self.assertEquals(4, len(client.api_version())) |
1958 | + self.assertEqual(4, len(client.api_version())) |
1959 | |
1960 | def test_api_version_later_same(self): |
1961 | self.assertTrue(client.api_version() <= client.version()) |
1962 | @@ -69,7 +69,7 @@ |
1963 | self.client.commit(["dc"]) |
1964 | r = ra.RemoteAccess(self.repos_url) |
1965 | revprops = r.rev_proplist(1) |
1966 | - self.assertEquals("Amessage", revprops["svn:log"]) |
1967 | + self.assertEqual("Amessage", revprops["svn:log"]) |
1968 | |
1969 | def test_commit_start(self): |
1970 | self.build_tree({"dc/foo": None}) |
1971 | @@ -79,7 +79,7 @@ |
1972 | self.client.commit(["dc"]) |
1973 | r = ra.RemoteAccess(self.repos_url) |
1974 | revprops = r.rev_proplist(1) |
1975 | - self.assertEquals("Bmessage", revprops["svn:log"]) |
1976 | + self.assertEqual("Bmessage", revprops["svn:log"]) |
1977 | |
1978 | def test_mkdir(self): |
1979 | self.client.mkdir(["dc/foo"]) |
1980 | @@ -91,18 +91,18 @@ |
1981 | self.client.add("dc/foo") |
1982 | self.client.commit(["dc"]) |
1983 | self.client.export(self.repos_url, "de") |
1984 | - self.assertEquals(["foo"], os.listdir("de")) |
1985 | + self.assertEqual(["foo"], os.listdir("de")) |
1986 | |
1987 | def test_add_recursive(self): |
1988 | self.build_tree({"dc/trunk/foo": 'bla', "dc/trunk": None}) |
1989 | self.client.add("dc/trunk") |
1990 | adm = wc.WorkingCopy(None, os.path.join(os.getcwd(), "dc")) |
1991 | e = adm.entry(os.path.join(os.getcwd(), "dc", "trunk")) |
1992 | - self.assertEquals(e.kind, NODE_DIR) |
1993 | + self.assertEqual(e.kind, NODE_DIR) |
1994 | adm2 = wc.WorkingCopy(None, os.path.join(os.getcwd(), "dc", "trunk")) |
1995 | e = adm2.entry(os.path.join(os.getcwd(), "dc", "trunk", "foo")) |
1996 | - self.assertEquals(e.kind, NODE_FILE) |
1997 | - self.assertEquals(e.revision, 0) |
1998 | + self.assertEqual(e.kind, NODE_FILE) |
1999 | + self.assertEqual(e.revision, 0) |
2000 | |
2001 | def test_get_config(self): |
2002 | self.assertIsInstance(client.get_config(), client.Config) |
2003 | @@ -140,9 +140,9 @@ |
2004 | return # Skip test |
2005 | |
2006 | (outf, errf) = self.client.diff(1, 2, self.repos_url, self.repos_url) |
2007 | - outf.seek(0) |
2008 | - errf.seek(0) |
2009 | - self.assertEquals("""Index: foo |
2010 | + self.addCleanup(outf.close) |
2011 | + self.addCleanup(errf.close) |
2012 | + self.assertEqual(b"""Index: foo |
2013 | =================================================================== |
2014 | --- foo\t(revision 1) |
2015 | +++ foo\t(revision 2) |
2016 | @@ -151,13 +151,13 @@ |
2017 | \\ No newline at end of file |
2018 | +foo2 |
2019 | \\ No newline at end of file |
2020 | -""", outf.read()) |
2021 | - self.assertEquals("", errf.read()) |
2022 | +""".splitlines(), outf.read().splitlines()) |
2023 | + self.assertEqual(b"", errf.read()) |
2024 | |
2025 | def assertCatEquals(self, value, revision=None): |
2026 | io = StringIO() |
2027 | self.client.cat("dc/foo", io, revision) |
2028 | - self.assertEquals(value, io.getvalue()) |
2029 | + self.assertEqual(value, io.getvalue()) |
2030 | |
2031 | def test_cat(self): |
2032 | self.build_tree({"dc/foo": "bla"}) |
2033 | @@ -174,10 +174,10 @@ |
2034 | def assertLogEntryChangedPathsEquals(self, expected, entry): |
2035 | changed_paths = entry["changed_paths"] |
2036 | self.assertIsInstance(changed_paths, dict) |
2037 | - self.assertEquals(sorted(expected), sorted(changed_paths.keys())) |
2038 | + self.assertEqual(sorted(expected), sorted(changed_paths.keys())) |
2039 | |
2040 | def assertLogEntryMessageEquals(self, expected, entry): |
2041 | - self.assertEquals(expected, entry["revprops"]["svn:log"]) |
2042 | + self.assertEqual(expected, entry["revprops"]["svn:log"]) |
2043 | |
2044 | def assertLogEntryDateAlmostEquals(self, expected, entry, delta): |
2045 | actual = datetime.strptime(entry["revprops"]["svn:date"], "%Y-%m-%dT%H:%M:%S.%fZ") |
2046 | @@ -201,9 +201,9 @@ |
2047 | self.client.commit(["dc"]) |
2048 | commit_1_dt = datetime.utcnow() |
2049 | self.client.log(cb, "dc/foo") |
2050 | - self.assertEquals(1, len(log_entries)) |
2051 | - self.assertEquals(None, log_entries[0]["changed_paths"]) |
2052 | - self.assertEquals(1, log_entries[0]["revision"]) |
2053 | + self.assertEqual(1, len(log_entries)) |
2054 | + self.assertEqual(None, log_entries[0]["changed_paths"]) |
2055 | + self.assertEqual(1, log_entries[0]["revision"]) |
2056 | self.assertLogEntryMessageEquals(commit_msg_1, log_entries[0]) |
2057 | self.assertLogEntryDateAlmostEquals(commit_1_dt, log_entries[0], delta) |
2058 | self.build_tree({ |
2059 | @@ -216,20 +216,20 @@ |
2060 | commit_2_dt = datetime.utcnow() |
2061 | log_entries = [] |
2062 | self.client.log(cb, "dc/foo", discover_changed_paths=True) |
2063 | - self.assertEquals(2, len(log_entries)) |
2064 | + self.assertEqual(2, len(log_entries)) |
2065 | self.assertLogEntryChangedPathsEquals(["/foo", "/bar"], log_entries[0]) |
2066 | - self.assertEquals(2, log_entries[0]["revision"]) |
2067 | + self.assertEqual(2, log_entries[0]["revision"]) |
2068 | self.assertLogEntryMessageEquals(commit_msg_2, log_entries[0]) |
2069 | self.assertLogEntryDateAlmostEquals(commit_2_dt, log_entries[0], delta) |
2070 | self.assertLogEntryChangedPathsEquals(["/foo"], log_entries[1]) |
2071 | - self.assertEquals(1, log_entries[1]["revision"]) |
2072 | + self.assertEqual(1, log_entries[1]["revision"]) |
2073 | self.assertLogEntryMessageEquals(commit_msg_1, log_entries[1]) |
2074 | self.assertLogEntryDateAlmostEquals(commit_1_dt, log_entries[1], delta) |
2075 | log_entries = [] |
2076 | self.client.log(cb, "dc/foo", start_rev=2, end_rev=2, discover_changed_paths=True) |
2077 | - self.assertEquals(1, len(log_entries)) |
2078 | + self.assertEqual(1, len(log_entries)) |
2079 | self.assertLogEntryChangedPathsEquals(["/foo", "/bar"], log_entries[0]) |
2080 | - self.assertEquals(2, log_entries[0]["revision"]) |
2081 | + self.assertEqual(2, log_entries[0]["revision"]) |
2082 | self.assertLogEntryMessageEquals(commit_msg_2, log_entries[0]) |
2083 | self.assertLogEntryDateAlmostEquals(commit_2_dt, log_entries[0], delta) |
2084 | |
2085 | @@ -239,16 +239,16 @@ |
2086 | self.client.log_msg_func = lambda c: "Commit" |
2087 | self.client.commit(["dc"]) |
2088 | info = self.client.info("dc/foo") |
2089 | - self.assertEquals(["dc/foo"], info.keys()) |
2090 | - self.assertEquals(1, info["dc/foo"].revision) |
2091 | + self.assertEqual(["dc/foo"], sorted(info.keys())) |
2092 | + self.assertEqual(1, info["dc/foo"].revision) |
2093 | self.assertIs(None, info["dc/foo"].size) |
2094 | - self.assertEquals(wc.SCHEDULE_NORMAL, info["dc/foo"].wc_info.schedule) |
2095 | + self.assertEqual(wc.SCHEDULE_NORMAL, info["dc/foo"].wc_info.schedule) |
2096 | self.build_tree({"dc/bar": "blablabla"}) |
2097 | self.client.add("dc/bar") |
2098 | info = self.client.info("dc/bar") |
2099 | - self.assertEquals(["dc/bar"], info.keys()) |
2100 | - self.assertEquals(0, info["dc/bar"].revision) |
2101 | - self.assertEquals(wc.SCHEDULE_ADD, info["dc/bar"].wc_info.schedule) |
2102 | + self.assertEqual(["dc/bar"], sorted(info.keys())) |
2103 | + self.assertEqual(0, info["dc/bar"].revision) |
2104 | + self.assertEqual(wc.SCHEDULE_ADD, info["dc/bar"].wc_info.schedule) |
2105 | |
2106 | def test_info_nonexistant(self): |
2107 | self.build_tree({"dc/foo": "bla"}) |
2108 | |
2109 | === modified file 'subvertpy/tests/test_delta.py' |
2110 | --- subvertpy/tests/test_delta.py 2011-02-19 20:33:38 +0000 |
2111 | +++ subvertpy/tests/test_delta.py 2012-04-07 06:08:21 +0000 |
2112 | @@ -15,7 +15,7 @@ |
2113 | |
2114 | """Tests for subvertpy.delta.""" |
2115 | |
2116 | -from cStringIO import StringIO |
2117 | +from io import StringIO |
2118 | |
2119 | from subvertpy.delta import ( |
2120 | decode_length, |
2121 | @@ -38,19 +38,19 @@ |
2122 | def test_send_stream(self): |
2123 | stream = StringIO("foo") |
2124 | send_stream(stream, self.storing_window_handler) |
2125 | - self.assertEquals([(0, 0, 3, 0, [(2, 0, 3)], 'foo'), None], |
2126 | + self.assertEqual([(0, 0, 3, 0, [(2, 0, 3)], b'foo'), None], |
2127 | self.windows) |
2128 | |
2129 | |
2130 | class MarshallTests(TestCase): |
2131 | |
2132 | def test_encode_length(self): |
2133 | - self.assertEquals("\x81\x02", encode_length(130)) |
2134 | + self.assertEqual("\x81\x02", encode_length(130)) |
2135 | |
2136 | def test_roundtrip_length(self): |
2137 | - self.assertEquals((42, ""), decode_length(encode_length(42))) |
2138 | + self.assertEqual((42, ""), decode_length(encode_length(42))) |
2139 | |
2140 | |
2141 | def test_roundtrip_window(self): |
2142 | mywindow = (0, 0, 3, 1, [(2, 0, 3)], 'foo') |
2143 | - self.assertEquals([mywindow], list(unpack_svndiff0(pack_svndiff0([mywindow])))) |
2144 | + self.assertEqual([mywindow], list(unpack_svndiff0(pack_svndiff0([mywindow])))) |
2145 | |
2146 | === modified file 'subvertpy/tests/test_properties.py' |
2147 | --- subvertpy/tests/test_properties.py 2012-03-11 03:45:45 +0000 |
2148 | +++ subvertpy/tests/test_properties.py 2012-04-07 06:08:21 +0000 |
2149 | @@ -29,7 +29,7 @@ |
2150 | super(TestProperties, self).setUp() |
2151 | |
2152 | def test_time_from_cstring(self): |
2153 | - self.assertEquals(1225704780716938L, properties.time_from_cstring("2008-11-03T09:33:00.716938Z")) |
2154 | + self.assertEqual(1225704780716938, properties.time_from_cstring("2008-11-03T09:33:00.716938Z")) |
2155 | |
2156 | def test_time_from_cstring_independent_from_dst(self): |
2157 | old_tz = os.environ.get('TZ', None) |
2158 | @@ -42,7 +42,7 @@ |
2159 | os.environ['TZ'] = 'Europe/London' |
2160 | time.tzset() |
2161 | # Now test a time within that DST |
2162 | - self.assertEquals(1275295762430000L, properties.time_from_cstring("2010-05-31T08:49:22.430000Z")) |
2163 | + self.assertEqual(1275295762430000, properties.time_from_cstring("2010-05-31T08:49:22.430000Z")) |
2164 | finally: |
2165 | if old_tz is None: |
2166 | del os.environ['TZ'] |
2167 | @@ -51,7 +51,7 @@ |
2168 | time.tzset() |
2169 | |
2170 | def test_time_to_cstring(self): |
2171 | - self.assertEquals("2008-11-03T09:33:00.716938Z", properties.time_to_cstring(1225704780716938L)) |
2172 | + self.assertEqual("2008-11-03T09:33:00.716938Z", properties.time_to_cstring(1225704780716938)) |
2173 | |
2174 | |
2175 | class TestExternalsParser(TestCase): |
2176 | @@ -123,47 +123,47 @@ |
2177 | |
2178 | class MergeInfoPropertyParserTests(TestCase): |
2179 | def test_simple_range(self): |
2180 | - self.assertEquals({"/trunk": [(1, 2, True)]}, properties.parse_mergeinfo_property("/trunk:1-2\n")) |
2181 | + self.assertEqual({"/trunk": [(1, 2, True)]}, properties.parse_mergeinfo_property("/trunk:1-2\n")) |
2182 | |
2183 | def test_simple_range_uninheritable(self): |
2184 | - self.assertEquals({"/trunk": [(1, 2, False)]}, properties.parse_mergeinfo_property("/trunk:1-2*\n")) |
2185 | + self.assertEqual({"/trunk": [(1, 2, False)]}, properties.parse_mergeinfo_property("/trunk:1-2*\n")) |
2186 | |
2187 | def test_simple_individual(self): |
2188 | - self.assertEquals({"/trunk": [(1, 1, True)]}, properties.parse_mergeinfo_property("/trunk:1\n")) |
2189 | + self.assertEqual({"/trunk": [(1, 1, True)]}, properties.parse_mergeinfo_property("/trunk:1\n")) |
2190 | |
2191 | def test_empty(self): |
2192 | - self.assertEquals({}, properties.parse_mergeinfo_property("")) |
2193 | + self.assertEqual({}, properties.parse_mergeinfo_property("")) |
2194 | |
2195 | |
2196 | class MergeInfoPropertyCreatorTests(TestCase): |
2197 | def test_simple_range(self): |
2198 | - self.assertEquals("/trunk:1-2\n", properties.generate_mergeinfo_property({"/trunk": [(1, 2, True)]})) |
2199 | + self.assertEqual("/trunk:1-2\n", properties.generate_mergeinfo_property({"/trunk": [(1, 2, True)]})) |
2200 | |
2201 | def test_simple_individual(self): |
2202 | - self.assertEquals("/trunk:1\n", properties.generate_mergeinfo_property({"/trunk": [(1, 1, True)]})) |
2203 | + self.assertEqual("/trunk:1\n", properties.generate_mergeinfo_property({"/trunk": [(1, 1, True)]})) |
2204 | |
2205 | def test_empty(self): |
2206 | - self.assertEquals("", properties.generate_mergeinfo_property({})) |
2207 | + self.assertEqual("", properties.generate_mergeinfo_property({})) |
2208 | |
2209 | |
2210 | class RevnumRangeTests(TestCase): |
2211 | def test_add_revnum_empty(self): |
2212 | - self.assertEquals([(1, 1, True)], properties.range_add_revnum([], 1)) |
2213 | + self.assertEqual([(1, 1, True)], properties.range_add_revnum([], 1)) |
2214 | |
2215 | def test_add_revnum_before(self): |
2216 | - self.assertEquals([(2, 2, True), (8, 8, True)], properties.range_add_revnum([(2, 2, True)], 8)) |
2217 | + self.assertEqual([(2, 2, True), (8, 8, True)], properties.range_add_revnum([(2, 2, True)], 8)) |
2218 | |
2219 | def test_add_revnum_included(self): |
2220 | - self.assertEquals([(1, 3, True)], properties.range_add_revnum([(1, 3, True)], 2)) |
2221 | + self.assertEqual([(1, 3, True)], properties.range_add_revnum([(1, 3, True)], 2)) |
2222 | |
2223 | def test_add_revnum_after(self): |
2224 | - self.assertEquals([(1, 3, True), (5, 5, True)], properties.range_add_revnum([(1, 3, True)], 5)) |
2225 | + self.assertEqual([(1, 3, True), (5, 5, True)], properties.range_add_revnum([(1, 3, True)], 5)) |
2226 | |
2227 | def test_add_revnum_extend_before(self): |
2228 | - self.assertEquals([(1, 3, True)], properties.range_add_revnum([(2, 3, True)], 1)) |
2229 | + self.assertEqual([(1, 3, True)], properties.range_add_revnum([(2, 3, True)], 1)) |
2230 | |
2231 | def test_add_revnum_extend_after(self): |
2232 | - self.assertEquals([(1, 3, True)], properties.range_add_revnum([(1, 2, True)], 3)) |
2233 | + self.assertEqual([(1, 3, True)], properties.range_add_revnum([(1, 2, True)], 3)) |
2234 | |
2235 | def test_revnum_includes_empty(self): |
2236 | self.assertFalse(properties.range_includes_revnum([], 2)) |
2237 | |
2238 | === modified file 'subvertpy/tests/test_ra.py' |
2239 | --- subvertpy/tests/test_ra.py 2011-11-08 14:41:55 +0000 |
2240 | +++ subvertpy/tests/test_ra.py 2012-04-07 06:08:21 +0000 |
2241 | @@ -15,7 +15,7 @@ |
2242 | |
2243 | """Subversion ra library tests.""" |
2244 | |
2245 | -from cStringIO import StringIO |
2246 | +from io import StringIO |
2247 | |
2248 | from subvertpy import ( |
2249 | NODE_DIR, NODE_NONE, NODE_UNKNOWN, |
2250 | @@ -30,10 +30,10 @@ |
2251 | class VersionTest(TestCase): |
2252 | |
2253 | def test_version_length(self): |
2254 | - self.assertEquals(4, len(ra.version())) |
2255 | + self.assertEqual(4, len(ra.version())) |
2256 | |
2257 | def test_api_version_length(self): |
2258 | - self.assertEquals(4, len(ra.api_version())) |
2259 | + self.assertEqual(4, len(ra.api_version())) |
2260 | |
2261 | def test_api_version_later_same(self): |
2262 | self.assertTrue(ra.api_version() <= ra.version()) |
2263 | @@ -66,15 +66,15 @@ |
2264 | dc.close() |
2265 | |
2266 | def test_repr(self): |
2267 | - self.assertEquals("RemoteAccess(\"%s\")" % self.repos_url, |
2268 | + self.assertEqual("RemoteAccess(\"%s\")" % self.repos_url, |
2269 | repr(self.ra)) |
2270 | |
2271 | def test_latest_revnum(self): |
2272 | - self.assertEquals(0, self.ra.get_latest_revnum()) |
2273 | + self.assertEqual(0, self.ra.get_latest_revnum()) |
2274 | |
2275 | def test_latest_revnum_one(self): |
2276 | self.do_commit() |
2277 | - self.assertEquals(1, self.ra.get_latest_revnum()) |
2278 | + self.assertEqual(1, self.ra.get_latest_revnum()) |
2279 | |
2280 | def test_get_uuid(self): |
2281 | self.assertIsInstance(self.ra.get_uuid(), str) |
2282 | @@ -109,8 +109,8 @@ |
2283 | self.do_commit() |
2284 | (dirents, fetch_rev, props) = self.ra.get_dir("/", 1, fields=ra.DIRENT_KIND) |
2285 | self.assertIsInstance(props, dict) |
2286 | - self.assertEquals(1, fetch_rev) |
2287 | - self.assertEquals(NODE_DIR, dirents["foo"]["kind"]) |
2288 | + self.assertEqual(1, fetch_rev) |
2289 | + self.assertEqual(NODE_DIR, dirents["foo"]["kind"]) |
2290 | |
2291 | def test_change_rev_prop(self): |
2292 | self.do_commit() |
2293 | @@ -151,29 +151,29 @@ |
2294 | |
2295 | def test_iter_log(self): |
2296 | def check_results(returned): |
2297 | - self.assertEquals(2, len(returned)) |
2298 | - self.assert_(len(returned[0]) in (3,4)) |
2299 | + self.assertEqual(2, len(returned)) |
2300 | + self.assertTrue(len(returned[0]) in (3,4)) |
2301 | if len(returned[0]) == 3: |
2302 | (paths, revnum, props) = returned[0] |
2303 | else: |
2304 | (paths, revnum, props, has_children) = returned[0] |
2305 | - self.assertEquals(None, paths) |
2306 | - self.assertEquals(revnum, 0) |
2307 | - self.assertEquals(["svn:date"], props.keys()) |
2308 | + self.assertEqual(None, paths) |
2309 | + self.assertEqual(revnum, 0) |
2310 | + self.assertEqual(["svn:date"], list(props.keys())) |
2311 | if len(returned[1]) == 3: |
2312 | (paths, revnum, props) = returned[1] |
2313 | else: |
2314 | (paths, revnum, props, has_children) = returned[1] |
2315 | if ra.api_version() < (1, 6): |
2316 | - self.assertEquals({'/foo': ('A', None, -1, NODE_UNKNOWN)}, paths) |
2317 | + self.assertEqual({'/foo': (b'A', None, -1, NODE_UNKNOWN)}, paths) |
2318 | else: |
2319 | - self.assertEquals({'/foo': ('A', None, -1, NODE_DIR)}, paths) |
2320 | - self.assertEquals(revnum, 1) |
2321 | - self.assertEquals(set(["svn:date", "svn:author", "svn:log"]), |
2322 | + self.assertEqual({'/foo': (b'A', None, -1, NODE_DIR)}, paths) |
2323 | + self.assertEqual(revnum, 1) |
2324 | + self.assertEqual(set(["svn:date", "svn:author", "svn:log"]), |
2325 | set(props.keys())) |
2326 | returned = list(self.ra.iter_log([""], 0, 0, |
2327 | revprops=["svn:date", "svn:author", "svn:log"])) |
2328 | - self.assertEquals(1, len(returned)) |
2329 | + self.assertEqual(1, len(returned)) |
2330 | self.do_commit() |
2331 | returned = list(self.ra.iter_log(None, 0, 1, discover_changed_paths=True, |
2332 | strict_node_history=False, revprops=["svn:date", "svn:author", "svn:log"])) |
2333 | @@ -184,25 +184,25 @@ |
2334 | def cb(*args): |
2335 | returned.append(args) |
2336 | def check_results(returned): |
2337 | - self.assertEquals(2, len(returned)) |
2338 | - self.assert_(len(returned[0]) in (3,4)) |
2339 | + self.assertEqual(2, len(returned)) |
2340 | + self.assertTrue(len(returned[0]) in (3,4)) |
2341 | if len(returned[0]) == 3: |
2342 | (paths, revnum, props) = returned[0] |
2343 | else: |
2344 | (paths, revnum, props, has_children) = returned[0] |
2345 | - self.assertEquals(None, paths) |
2346 | - self.assertEquals(revnum, 0) |
2347 | - self.assertEquals(["svn:date"], props.keys()) |
2348 | + self.assertEqual(None, paths) |
2349 | + self.assertEqual(revnum, 0) |
2350 | + self.assertEqual(["svn:date"], list(props.keys())) |
2351 | if len(returned[1]) == 3: |
2352 | (paths, revnum, props) = returned[1] |
2353 | else: |
2354 | (paths, revnum, props, has_children) = returned[1] |
2355 | - self.assertEquals({'/foo': ('A', None, -1)}, paths) |
2356 | - self.assertEquals(revnum, 1) |
2357 | - self.assertEquals(set(["svn:date", "svn:author", "svn:log"]), |
2358 | + self.assertEqual({'/foo': (b'A', None, -1)}, paths) |
2359 | + self.assertEqual(revnum, 1) |
2360 | + self.assertEqual(set(["svn:date", "svn:author", "svn:log"]), |
2361 | set(props.keys())) |
2362 | self.ra.get_log(cb, [""], 0, 0, revprops=["svn:date", "svn:author", "svn:log"]) |
2363 | - self.assertEquals(1, len(returned)) |
2364 | + self.assertEqual(1, len(returned)) |
2365 | self.do_commit() |
2366 | returned = [] |
2367 | self.ra.get_log(cb, None, 0, 1, discover_changed_paths=True, |
2368 | @@ -254,7 +254,7 @@ |
2369 | root.close() |
2370 | editor.close() |
2371 | |
2372 | - self.assertEquals(set(['bar:foo', 'svn:author', 'svn:custom:blie', 'svn:date', 'svn:log']), set(self.ra.rev_proplist(1).keys())) |
2373 | + self.assertEqual(set(['bar:foo', 'svn:author', 'svn:custom:blie', 'svn:date', 'svn:log']), set(self.ra.rev_proplist(1).keys())) |
2374 | |
2375 | def test_get_commit_editor_context_manager(self): |
2376 | def mycb(paths, rev, revprops): |
2377 | @@ -292,7 +292,7 @@ |
2378 | |
2379 | stream = StringIO() |
2380 | props = self.ra.get_file("bar", stream, 1)[1] |
2381 | - self.assertEquals("blie", props.get("bla:bar")) |
2382 | + self.assertEqual("blie", props.get("bla:bar")) |
2383 | stream = StringIO() |
2384 | props = self.ra.get_file("bar", stream, 2)[1] |
2385 | self.assertIs(None, props.get("bla:bar")) |
2386 | @@ -315,11 +315,11 @@ |
2387 | |
2388 | self.ra.get_file_revs("bar", 1, 2, handle) |
2389 | |
2390 | - self.assertEquals(2, len(rets)) |
2391 | - self.assertEquals(1, rets[0][1]) |
2392 | - self.assertEquals(2, rets[1][1]) |
2393 | - self.assertEquals("/bar", rets[0][0]) |
2394 | - self.assertEquals("/bar", rets[1][0]) |
2395 | + self.assertEqual(2, len(rets)) |
2396 | + self.assertEqual(1, rets[0][1]) |
2397 | + self.assertEqual(2, rets[1][1]) |
2398 | + self.assertEqual("/bar", rets[0][0]) |
2399 | + self.assertEqual("/bar", rets[1][0]) |
2400 | |
2401 | def test_get_file(self): |
2402 | cb = self.commit_editor() |
2403 | @@ -329,24 +329,24 @@ |
2404 | stream = StringIO() |
2405 | self.ra.get_file("bar", stream, 1) |
2406 | stream.seek(0) |
2407 | - self.assertEquals("a", stream.read()) |
2408 | + self.assertEqual("a", stream.read()) |
2409 | |
2410 | stream = StringIO() |
2411 | self.ra.get_file("/bar", stream, 1) |
2412 | stream.seek(0) |
2413 | - self.assertEquals("a", stream.read()) |
2414 | + self.assertEqual("a", stream.read()) |
2415 | |
2416 | def test_get_locations_root(self): |
2417 | - self.assertEquals({0: "/"}, self.ra.get_locations("", 0, [0])) |
2418 | + self.assertEqual({0: "/"}, self.ra.get_locations("", 0, [0])) |
2419 | |
2420 | def test_check_path(self): |
2421 | cb = self.commit_editor() |
2422 | cb.add_dir("bar") |
2423 | cb.close() |
2424 | |
2425 | - self.assertEquals(NODE_DIR, self.ra.check_path("bar", 1)) |
2426 | - self.assertEquals(NODE_DIR, self.ra.check_path("bar/", 1)) |
2427 | - self.assertEquals(NODE_NONE, self.ra.check_path("blaaaa", 1)) |
2428 | + self.assertEqual(NODE_DIR, self.ra.check_path("bar", 1)) |
2429 | + self.assertEqual(NODE_DIR, self.ra.check_path("bar/", 1)) |
2430 | + self.assertEqual(NODE_NONE, self.ra.check_path("blaaaa", 1)) |
2431 | |
2432 | def test_check_path_with_unsafe_path(self): |
2433 | # The SVN code asserts that paths do not have a leading '/'... And if |
2434 | @@ -361,7 +361,7 @@ |
2435 | cb.close() |
2436 | |
2437 | ret = self.ra.stat("bar", 1) |
2438 | - self.assertEquals(set(['last_author', 'kind', 'created_rev', 'has_props', 'time', 'size']), set(ret.keys())) |
2439 | + self.assertEqual(set(['last_author', 'kind', 'created_rev', 'has_props', 'time', 'size']), set(ret.keys())) |
2440 | |
2441 | def test_get_locations_dir(self): |
2442 | cb = self.commit_editor() |
2443 | @@ -376,16 +376,16 @@ |
2444 | cb.delete("bar") |
2445 | cb.close() |
2446 | |
2447 | - self.assertEquals({1: "/bar", 2: "/bla"}, |
2448 | + self.assertEqual({1: "/bar", 2: "/bla"}, |
2449 | self.ra.get_locations("bla", 2, [1,2])) |
2450 | |
2451 | - self.assertEquals({1: "/bar", 2: "/bar"}, |
2452 | + self.assertEqual({1: "/bar", 2: "/bar"}, |
2453 | self.ra.get_locations("bar", 1, [1,2])) |
2454 | |
2455 | - self.assertEquals({1: "/bar", 2: "/bar"}, |
2456 | + self.assertEqual({1: "/bar", 2: "/bar"}, |
2457 | self.ra.get_locations("bar", 2, [1,2])) |
2458 | |
2459 | - self.assertEquals({1: "/bar", 2: "/bla", 3: "/bla"}, |
2460 | + self.assertEqual({1: "/bar", 2: "/bla", 3: "/bla"}, |
2461 | self.ra.get_locations("bla", 3, [1,2,3])) |
2462 | |
2463 | def test_get_locations_dir_with_unsafe_path(self): |
2464 | @@ -405,33 +405,33 @@ |
2465 | def test_simple(self): |
2466 | auth = ra.Auth([ra.get_simple_prompt_provider(lambda realm, uname, may_save: ("foo", "geheim", False), 0)]) |
2467 | creds = auth.credentials("svn.simple", "MyRealm") |
2468 | - self.assertEquals(("foo", "geheim", 0), creds.next()) |
2469 | - self.assertRaises(StopIteration, creds.next) |
2470 | + self.assertEqual(("foo", "geheim", 0), next(creds)) |
2471 | + self.assertRaises(StopIteration, creds.__next__) |
2472 | |
2473 | def test_username(self): |
2474 | auth = ra.Auth([ra.get_username_prompt_provider(lambda realm, may_save: ("somebody", False), 0)]) |
2475 | creds = auth.credentials("svn.username", "MyRealm") |
2476 | - self.assertEquals(("somebody", 0), creds.next()) |
2477 | - self.assertRaises(StopIteration, creds.next) |
2478 | + self.assertEqual(("somebody", 0), next(creds)) |
2479 | + self.assertRaises(StopIteration, creds.__next__) |
2480 | |
2481 | def test_client_cert(self): |
2482 | auth = ra.Auth([ra.get_ssl_client_cert_prompt_provider(lambda realm, may_save: ("filename", False), 0)]) |
2483 | creds = auth.credentials("svn.ssl.client-cert", "MyRealm") |
2484 | - self.assertEquals(("filename", False), creds.next()) |
2485 | - self.assertRaises(StopIteration, creds.next) |
2486 | + self.assertEqual(("filename", False), next(creds)) |
2487 | + self.assertRaises(StopIteration, creds.__next__) |
2488 | |
2489 | def test_client_cert_pw(self): |
2490 | auth = ra.Auth([ra.get_ssl_client_cert_pw_prompt_provider(lambda realm, may_save: ("supergeheim", False), 0)]) |
2491 | creds = auth.credentials("svn.ssl.client-passphrase", "MyRealm") |
2492 | - self.assertEquals(("supergeheim", False), creds.next()) |
2493 | - self.assertRaises(StopIteration, creds.next) |
2494 | + self.assertEqual(("supergeheim", False), next(creds)) |
2495 | + self.assertRaises(StopIteration, creds.__next__) |
2496 | |
2497 | def test_server_trust(self): |
2498 | auth = ra.Auth([ra.get_ssl_server_trust_prompt_provider(lambda realm, failures, certinfo, may_save: (42, False))]) |
2499 | auth.set_parameter("svn:auth:ssl:failures", 23) |
2500 | creds = auth.credentials("svn.ssl.server", "MyRealm") |
2501 | - self.assertEquals((42, 0), creds.next()) |
2502 | - self.assertRaises(StopIteration, creds.next) |
2503 | + self.assertEqual((42, 0), next(creds)) |
2504 | + self.assertRaises(StopIteration, creds.__next__) |
2505 | |
2506 | def test_retry(self): |
2507 | self.i = 0 |
2508 | @@ -440,20 +440,20 @@ |
2509 | return ("somebody%d" % self.i, False) |
2510 | auth = ra.Auth([ra.get_username_prompt_provider(inc_foo, 2)]) |
2511 | creds = auth.credentials("svn.username", "MyRealm") |
2512 | - self.assertEquals(("somebody1", 0), creds.next()) |
2513 | - self.assertEquals(("somebody2", 0), creds.next()) |
2514 | - self.assertEquals(("somebody3", 0), creds.next()) |
2515 | - self.assertRaises(StopIteration, creds.next) |
2516 | + self.assertEqual(("somebody1", 0), next(creds)) |
2517 | + self.assertEqual(("somebody2", 0), next(creds)) |
2518 | + self.assertEqual(("somebody3", 0), next(creds)) |
2519 | + self.assertRaises(StopIteration, creds.__next__) |
2520 | |
2521 | def test_set_default_username(self): |
2522 | a = ra.Auth([]) |
2523 | a.set_parameter("svn:auth:username", "foo") |
2524 | - self.assertEquals("foo", a.get_parameter("svn:auth:username")) |
2525 | + self.assertEqual("foo", a.get_parameter("svn:auth:username")) |
2526 | |
2527 | def test_set_default_password(self): |
2528 | a = ra.Auth([]) |
2529 | a.set_parameter("svn:auth:password", "bar") |
2530 | - self.assertEquals("bar", a.get_parameter("svn:auth:password")) |
2531 | + self.assertEqual("bar", a.get_parameter("svn:auth:password")) |
2532 | |
2533 | def test_platform_auth_providers(self): |
2534 | ra.Auth(ra.get_platform_specific_client_providers()) |
2535 | |
2536 | === modified file 'subvertpy/tests/test_repos.py' |
2537 | --- subvertpy/tests/test_repos.py 2011-09-13 11:15:18 +0000 |
2538 | +++ subvertpy/tests/test_repos.py 2012-04-07 06:08:21 +0000 |
2539 | @@ -15,7 +15,7 @@ |
2540 | |
2541 | """Subversion repository library tests.""" |
2542 | |
2543 | -from cStringIO import StringIO |
2544 | +from io import StringIO |
2545 | import os |
2546 | import textwrap |
2547 | |
2548 | @@ -26,10 +26,10 @@ |
2549 | class VersionTest(TestCase): |
2550 | |
2551 | def test_version_length(self): |
2552 | - self.assertEquals(4, len(repos.version())) |
2553 | + self.assertEqual(4, len(repos.version())) |
2554 | |
2555 | def test_api_version_length(self): |
2556 | - self.assertEquals(4, len(repos.api_version())) |
2557 | + self.assertEqual(4, len(repos.api_version())) |
2558 | |
2559 | def test_api_version_later_same(self): |
2560 | self.assertTrue(repos.api_version() <= repos.version()) |
2561 | @@ -54,7 +54,7 @@ |
2562 | r = repos.create(os.path.join(self.test_dir, "foo")) |
2563 | f = StringIO() |
2564 | r.verify_fs(f, 0, 0) |
2565 | - self.assertEquals('* Verified revision 0.\n', f.getvalue()) |
2566 | + self.assertEqual('* Verified revision 0.\n', f.getvalue()) |
2567 | |
2568 | def test_open(self): |
2569 | repos.create(os.path.join(self.test_dir, "foo")) |
2570 | @@ -66,7 +66,7 @@ |
2571 | |
2572 | def test_youngest_rev(self): |
2573 | repos.create(os.path.join(self.test_dir, "foo")) |
2574 | - self.assertEquals(0, repos.Repository("foo").fs().youngest_revision()) |
2575 | + self.assertEqual(0, repos.Repository("foo").fs().youngest_revision()) |
2576 | |
2577 | def test_rev_root(self): |
2578 | repos.create(os.path.join(self.test_dir, "foo")) |
2579 | @@ -98,11 +98,11 @@ |
2580 | """) |
2581 | feedback = StringIO() |
2582 | r.load_fs(StringIO(dumpfile), feedback, repos.LOAD_UUID_DEFAULT) |
2583 | - self.assertEquals(r.fs().get_uuid(), "38f0a982-fd1f-4e00-aa6b-a20720f4b9ca") |
2584 | + self.assertEqual(r.fs().get_uuid(), "38f0a982-fd1f-4e00-aa6b-a20720f4b9ca") |
2585 | |
2586 | def test_rev_props(self): |
2587 | repos.create(os.path.join(self.test_dir, "foo")) |
2588 | - self.assertEquals(["svn:date"], repos.Repository("foo").fs().revision_proplist(0).keys()) |
2589 | + self.assertEqual(["svn:date"], list(repos.Repository("foo").fs().revision_proplist(0).keys())) |
2590 | |
2591 | def test_rev_root_invalid(self): |
2592 | repos.create(os.path.join(self.test_dir, "foo")) |
2593 | @@ -115,19 +115,19 @@ |
2594 | def test_paths_changed(self): |
2595 | repos.create(os.path.join(self.test_dir, "foo")) |
2596 | root = repos.Repository("foo").fs().revision_root(0) |
2597 | - self.assertEquals({}, root.paths_changed()) |
2598 | + self.assertEqual({}, root.paths_changed()) |
2599 | |
2600 | def test_is_dir(self): |
2601 | repos.create(os.path.join(self.test_dir, "foo")) |
2602 | root = repos.Repository("foo").fs().revision_root(0) |
2603 | - self.assertEquals(True, root.is_dir("")) |
2604 | - self.assertEquals(False, root.is_dir("nonexistant")) |
2605 | + self.assertEqual(True, root.is_dir("")) |
2606 | + self.assertEqual(False, root.is_dir("nonexistant")) |
2607 | |
2608 | def test_is_file(self): |
2609 | repos.create(os.path.join(self.test_dir, "foo")) |
2610 | root = repos.Repository("foo").fs().revision_root(0) |
2611 | - self.assertEquals(False, root.is_file("")) |
2612 | - self.assertEquals(False, root.is_file("nonexistant")) |
2613 | + self.assertEqual(False, root.is_file("")) |
2614 | + self.assertEqual(False, root.is_file("nonexistant")) |
2615 | |
2616 | |
2617 | class StreamTests(TestCase): |
2618 | @@ -137,12 +137,12 @@ |
2619 | if repos.api_version() < (1, 6): |
2620 | self.assertRaises(NotImplementedError, s.read) |
2621 | else: |
2622 | - self.assertEquals("", s.read()) |
2623 | - self.assertEquals("", s.read(15)) |
2624 | + self.assertEqual(b"", s.read()) |
2625 | + self.assertEqual(b"", s.read(15)) |
2626 | s.close() |
2627 | |
2628 | def test_write(self): |
2629 | s = repos.Stream() |
2630 | - self.assertEquals(0, s.write("")) |
2631 | - self.assertEquals(2, s.write("ab")) |
2632 | + self.assertEqual(0, s.write("")) |
2633 | + self.assertEqual(2, s.write("ab")) |
2634 | s.close() |
2635 | |
2636 | === modified file 'subvertpy/tests/test_wc.py' |
2637 | --- subvertpy/tests/test_wc.py 2011-12-13 19:14:03 +0000 |
2638 | +++ subvertpy/tests/test_wc.py 2012-04-07 06:08:21 +0000 |
2639 | @@ -15,7 +15,7 @@ |
2640 | |
2641 | """Subversion ra library tests.""" |
2642 | |
2643 | -from StringIO import StringIO |
2644 | +from io import StringIO |
2645 | import os |
2646 | |
2647 | import subvertpy |
2648 | @@ -32,10 +32,10 @@ |
2649 | class VersionTest(TestCase): |
2650 | |
2651 | def test_version_length(self): |
2652 | - self.assertEquals(4, len(wc.version())) |
2653 | + self.assertEqual(4, len(wc.version())) |
2654 | |
2655 | def test_api_version_length(self): |
2656 | - self.assertEquals(4, len(wc.api_version())) |
2657 | + self.assertEqual(4, len(wc.api_version())) |
2658 | |
2659 | def test_api_version_later_same(self): |
2660 | self.assertTrue(wc.api_version() <= wc.version()) |
2661 | @@ -44,13 +44,13 @@ |
2662 | class WorkingCopyTests(TestCase): |
2663 | |
2664 | def test_get_adm_dir(self): |
2665 | - self.assertEquals(".svn", wc.get_adm_dir()) |
2666 | + self.assertEqual(".svn", wc.get_adm_dir()) |
2667 | |
2668 | def test_set_adm_dir(self): |
2669 | old_dir_name = wc.get_adm_dir() |
2670 | try: |
2671 | wc.set_adm_dir("_svn") |
2672 | - self.assertEquals("_svn", wc.get_adm_dir()) |
2673 | + self.assertEqual("_svn", wc.get_adm_dir()) |
2674 | finally: |
2675 | wc.set_adm_dir(old_dir_name) |
2676 | |
2677 | @@ -78,12 +78,12 @@ |
2678 | def test_revision_status(self): |
2679 | repos_url = self.make_client("repos", "checkout") |
2680 | ret = wc.revision_status("checkout") |
2681 | - self.assertEquals((0, 0, 0, 0), ret) |
2682 | + self.assertEqual((0, 0, 0, 0), ret) |
2683 | |
2684 | def test_revision_status_trailing(self): |
2685 | repos_url = self.make_client("repos", "checkout") |
2686 | ret = wc.revision_status("checkout/") |
2687 | - self.assertEquals((0, 0, 0, 0), ret) |
2688 | + self.assertEqual((0, 0, 0, 0), ret) |
2689 | |
2690 | |
2691 | class AdmTests(SubversionTestCase): |
2692 | @@ -103,7 +103,7 @@ |
2693 | self.client_add('checkout/bar') |
2694 | adm = wc.WorkingCopy(None, "checkout") |
2695 | path = os.path.join(self.test_dir, "checkout/bar") |
2696 | - self.assertEquals(("%s/bar" % repos_url, 0), adm.get_ancestry("checkout/bar")) |
2697 | + self.assertEqual(("%s/bar" % repos_url, 0), adm.get_ancestry("checkout/bar")) |
2698 | adm.close() |
2699 | |
2700 | def test_maybe_set_repos_root(self): |
2701 | @@ -116,7 +116,7 @@ |
2702 | repos_url = self.make_client("repos", "checkout") |
2703 | adm = wc.WorkingCopy(None, "checkout", True) |
2704 | adm.add_repos_file("checkout/bar", StringIO("basecontents"), StringIO("contents"), {}, {}) |
2705 | - self.assertEquals("basecontents", wc.get_pristine_contents("checkout/bar").read()) |
2706 | + self.assertEqual(b"basecontents", wc.get_pristine_contents("checkout/bar").read()) |
2707 | |
2708 | def test_mark_missing_deleted(self): |
2709 | repos_url = self.make_client("repos", "checkout") |
2710 | @@ -149,7 +149,7 @@ |
2711 | adm = wc.WorkingCopy(None, "checkout", True) |
2712 | path = os.path.join(self.test_dir, "checkout/bar") |
2713 | stream = adm.translated_stream(path, path, wc.TRANSLATE_TO_NF) |
2714 | - self.assertTrue(stream.read().startswith("My id: $Id: ")) |
2715 | + self.assertTrue(stream.read().startswith(b"My id: $Id: ")) |
2716 | |
2717 | def test_text_modified(self): |
2718 | repos_url = self.make_client("repos", "checkout") |
2719 | @@ -179,9 +179,9 @@ |
2720 | self.client_add('checkout/bar') |
2721 | adm = wc.WorkingCopy(None, "checkout", True) |
2722 | adm.prop_set("aprop", "avalue", "checkout/bar") |
2723 | - self.assertEquals(adm.prop_get("aprop", "checkout/bar"), "avalue") |
2724 | + self.assertEqual(adm.prop_get("aprop", "checkout/bar"), "avalue") |
2725 | adm.prop_set("aprop", None, "checkout/bar") |
2726 | - self.assertEquals(adm.prop_get("aprop", "checkout/bar"), None) |
2727 | + self.assertEqual(adm.prop_get("aprop", "checkout/bar"), None) |
2728 | |
2729 | def test_committed_queue(self): |
2730 | if getattr(wc, "CommittedQueue", None) is None: |
2731 | @@ -202,19 +202,19 @@ |
2732 | self.client_add('checkout/bar') |
2733 | adm = wc.WorkingCopy(None, "checkout") |
2734 | entry = adm.entry("checkout/bar") |
2735 | - self.assertEquals("bar", entry.name) |
2736 | - self.assertEquals(NODE_FILE, entry.kind) |
2737 | - self.assertEquals(0, entry.revision) |
2738 | + self.assertEqual("bar", entry.name) |
2739 | + self.assertEqual(NODE_FILE, entry.kind) |
2740 | + self.assertEqual(0, entry.revision) |
2741 | self.client_commit("checkout", "msg") |
2742 | adm = wc.WorkingCopy(None, "checkout") |
2743 | entry = adm.entry("checkout/bar") |
2744 | - self.assertEquals("bar", entry.name) |
2745 | - self.assertEquals(NODE_FILE, entry.kind) |
2746 | - self.assertEquals(1, entry.revision) |
2747 | + self.assertEqual("bar", entry.name) |
2748 | + self.assertEqual(NODE_FILE, entry.kind) |
2749 | + self.assertEqual(1, entry.revision) |
2750 | |
2751 | def test_get_actual_target(self): |
2752 | repos_url = self.make_client("repos", ".") |
2753 | - self.assertEquals((self.test_dir, "bla"), |
2754 | + self.assertEqual((self.test_dir, "bla"), |
2755 | wc.get_actual_target("%s/bla" % self.test_dir)) |
2756 | |
2757 | def test_is_wc_root(self): |
2758 | @@ -230,10 +230,10 @@ |
2759 | self.build_tree({"checkout/bar": "text"}) |
2760 | self.client_add('checkout/bar') |
2761 | adm = wc.WorkingCopy(None, "checkout") |
2762 | - self.assertEquals(wc.STATUS_ADDED, adm.status('bar').status) |
2763 | + self.assertEqual(wc.STATUS_ADDED, adm.status('bar').status) |
2764 | self.client_commit("checkout", "foo") |
2765 | adm = wc.WorkingCopy(None, "checkout") |
2766 | - self.assertEquals(wc.STATUS_NORMAL, adm.status('bar').status) |
2767 | + self.assertEqual(wc.STATUS_NORMAL, adm.status('bar').status) |
2768 | |
2769 | def test_transmit_text_deltas(self): |
2770 | repos_url = self.make_client("repos", ".") |
2771 | @@ -255,24 +255,24 @@ |
2772 | pass |
2773 | editor = Editor() |
2774 | (tmpfile, digest) = adm.transmit_text_deltas("bar", True, editor) |
2775 | - self.assertEquals(editor._windows, [(0L, 0, 5, 0, [(2, 0, 5)], 'blala'), None]) |
2776 | + self.assertEqual(editor._windows, [(0, 0, 5, 0, [(2, 0, 5)], b'blala'), None]) |
2777 | self.assertIsInstance(tmpfile, str) |
2778 | - self.assertEquals(16, len(digest)) |
2779 | + self.assertEqual(16, len(digest)) |
2780 | |
2781 | bar = adm.entry("bar") |
2782 | - self.assertEquals(-1, bar.cmt_rev) |
2783 | - self.assertEquals(0, bar.revision) |
2784 | + self.assertEqual(-1, bar.cmt_rev) |
2785 | + self.assertEqual(0, bar.revision) |
2786 | |
2787 | cq = wc.CommittedQueue() |
2788 | cq.queue("bar", adm) |
2789 | adm.process_committed_queue(cq, 1, "2010-05-31T08:49:22.430000Z", "jelmer") |
2790 | bar = adm.entry("bar") |
2791 | - self.assertEquals("bar", bar.name) |
2792 | - self.assertEquals(NODE_FILE, bar.kind) |
2793 | - self.assertEquals(wc.SCHEDULE_NORMAL, bar.schedule) |
2794 | + self.assertEqual("bar", bar.name) |
2795 | + self.assertEqual(NODE_FILE, bar.kind) |
2796 | + self.assertEqual(wc.SCHEDULE_NORMAL, bar.schedule) |
2797 | self.assertIs(None, bar.checksum) |
2798 | - self.assertEquals(1, bar.cmt_rev) |
2799 | - self.assertEquals(1, bar.revision) |
2800 | + self.assertEqual(1, bar.cmt_rev) |
2801 | + self.assertEqual(1, bar.revision) |
2802 | |
2803 | def test_process_committed_queue(self): |
2804 | repos_url = self.make_client("repos", "checkout") |
2805 | @@ -283,9 +283,9 @@ |
2806 | cq.queue(os.path.join(self.test_dir, "checkout/bar"), adm) |
2807 | adm.process_committed_queue(cq, 1, "2010-05-31T08:49:22.430000Z", "jelmer") |
2808 | bar = adm.entry("checkout/bar") |
2809 | - self.assertEquals("bar", bar.name) |
2810 | - self.assertEquals(NODE_FILE, bar.kind) |
2811 | - self.assertEquals(wc.SCHEDULE_ADD, bar.schedule) |
2812 | + self.assertEqual("bar", bar.name) |
2813 | + self.assertEqual(NODE_FILE, bar.kind) |
2814 | + self.assertEqual(wc.SCHEDULE_ADD, bar.schedule) |
2815 | |
2816 | def test_probe_try(self): |
2817 | repos_url = self.make_client("repos", "checkout") |
2818 | @@ -294,7 +294,20 @@ |
2819 | adm = wc.WorkingCopy(None, "checkout", True) |
2820 | try: |
2821 | self.assertIs(None, adm.probe_try(self.test_dir)) |
2822 | - except subvertpy.SubversionException, (msg, num): |
2823 | - if num != subvertpy.ERR_WC_NOT_WORKING_COPY: |
2824 | + except subvertpy.SubversionException: |
2825 | + _, e, _ = sys.exc_info() |
2826 | + if e.num != subvertpy.ERR_WC_NOT_WORKING_COPY: |
2827 | raise |
2828 | - self.assertEquals("checkout", adm.probe_try(os.path.join("checkout", "bar")).access_path()) |
2829 | + self.assertEqual("checkout", adm.probe_try(os.path.join("checkout", "bar")).access_path()) |
2830 | + |
2831 | + def test_walk_entries(self): |
2832 | + repos_url = self.make_client("repos", "checkout") |
2833 | + self.build_tree({"checkout/bar": "\x00\x01"}) |
2834 | + self.client_add('checkout/bar') |
2835 | + adm = wc.WorkingCopy(None, "checkout") |
2836 | + paths = [] |
2837 | + def callback(path, entry): |
2838 | + paths.append(path) |
2839 | + adm.walk_entries('checkout', callback) |
2840 | + self.assertEqual(['checkout', os.path.join('checkout', 'bar')], |
2841 | + paths) |
2842 | \ No newline at end of file |
2843 | |
2844 | === modified file 'subvertpy/util.c' |
2845 | --- subvertpy/util.c 2012-02-24 06:42:47 +0000 |
2846 | +++ subvertpy/util.c 2012-04-07 06:08:21 +0000 |
2847 | @@ -176,22 +176,32 @@ |
2848 | Py_DECREF(excobj); |
2849 | } |
2850 | |
2851 | -PyObject *PyOS_tmpfile(void) |
2852 | +PyObject *PyOS_tmpfile(apr_file_t** file, apr_pool_t* temp_pool) |
2853 | { |
2854 | - PyObject *osmodule, *tmpfile_fn, *ret; |
2855 | + PyObject *tempfile, *tmpfile_fn, *ret; |
2856 | |
2857 | - osmodule = PyImport_ImportModule("os"); |
2858 | - if (osmodule == NULL) |
2859 | + tempfile = PyImport_ImportModule("tempfile"); |
2860 | + if (tempfile == NULL) |
2861 | return NULL; |
2862 | |
2863 | - tmpfile_fn = PyObject_GetAttrString(osmodule, "tmpfile"); |
2864 | - Py_DECREF(osmodule); |
2865 | + tmpfile_fn = PyObject_GetAttrString(tempfile, "TemporaryFile"); |
2866 | + Py_DECREF(tempfile); |
2867 | |
2868 | if (tmpfile_fn == NULL) |
2869 | return NULL; |
2870 | |
2871 | ret = PyObject_CallObject(tmpfile_fn, NULL); |
2872 | Py_DECREF(tmpfile_fn); |
2873 | + if (file == NULL || temp_pool == NULL) |
2874 | + { |
2875 | + return ret; |
2876 | + } |
2877 | + *file = apr_file_from_object(ret, temp_pool); |
2878 | + if (*file == NULL) |
2879 | + { |
2880 | + Py_DECREF(ret); |
2881 | + return NULL; |
2882 | + } |
2883 | return ret; |
2884 | } |
2885 | |
2886 | @@ -241,11 +251,11 @@ |
2887 | } |
2888 | for (i = 0; i < PyList_GET_SIZE(l); i++) { |
2889 | PyObject *item = PyList_GET_ITEM(l, i); |
2890 | - if (!PyString_Check(item)) { |
2891 | + if (!PyUnicode_Check(item)) { |
2892 | PyErr_Format(PyExc_TypeError, "Expected list of strings, item was %s", item->ob_type->tp_name); |
2893 | return false; |
2894 | } |
2895 | - APR_ARRAY_PUSH(*ret, char *) = apr_pstrdup(pool, PyString_AsString(item)); |
2896 | + APR_ARRAY_PUSH(*ret, char *) = apr_pstrdup(pool, _PyUnicode_AsString(item)); |
2897 | } |
2898 | return true; |
2899 | } |
2900 | @@ -257,18 +267,18 @@ |
2901 | *ret = NULL; |
2902 | return true; |
2903 | } |
2904 | - if (PyString_Check(l)) { |
2905 | + if (PyUnicode_Check(l)) { |
2906 | *ret = apr_array_make(pool, 1, sizeof(char *)); |
2907 | - APR_ARRAY_PUSH(*ret, const char *) = svn_path_canonicalize(PyString_AsString(l), pool); |
2908 | + APR_ARRAY_PUSH(*ret, const char *) = svn_path_canonicalize(_PyUnicode_AsString(l), pool); |
2909 | } else if (PyList_Check(l)) { |
2910 | *ret = apr_array_make(pool, PyList_Size(l), sizeof(char *)); |
2911 | for (i = 0; i < PyList_GET_SIZE(l); i++) { |
2912 | PyObject *item = PyList_GET_ITEM(l, i); |
2913 | - if (!PyString_Check(item)) { |
2914 | + if (!PyUnicode_Check(item)) { |
2915 | PyErr_Format(PyExc_TypeError, "Expected list of strings, item was %s", item->ob_type->tp_name); |
2916 | return false; |
2917 | } |
2918 | - APR_ARRAY_PUSH(*ret, const char *) = svn_path_canonicalize(PyString_AsString(item), pool); |
2919 | + APR_ARRAY_PUSH(*ret, const char *) = svn_path_canonicalize(_PyUnicode_AsString(item), pool); |
2920 | } |
2921 | } else { |
2922 | PyErr_Format(PyExc_TypeError, "Expected list of strings, got: %s", |
2923 | @@ -305,7 +315,7 @@ |
2924 | py_val = Py_None; |
2925 | Py_INCREF(py_val); |
2926 | } else { |
2927 | - py_val = PyString_FromStringAndSize(val->data, val->len); |
2928 | + py_val = PyUnicode_DecodeUTF8(val->data, val->len, NULL); |
2929 | } |
2930 | if (py_val == NULL) { |
2931 | Py_DECREF(py_props); |
2932 | @@ -316,7 +326,7 @@ |
2933 | py_key = Py_None; |
2934 | Py_INCREF(py_key); |
2935 | } else { |
2936 | - py_key = PyString_FromString(key); |
2937 | + py_key = PyUnicode_FromString(key); |
2938 | } |
2939 | if (PyDict_SetItem(py_props, py_key, py_val) != 0) { |
2940 | Py_DECREF(py_key); |
2941 | @@ -352,21 +362,21 @@ |
2942 | |
2943 | while (PyDict_Next(py_props, &idx, &k, &v)) { |
2944 | |
2945 | - if (!PyString_Check(k)) { |
2946 | + if (!PyUnicode_Check(k)) { |
2947 | PyErr_SetString(PyExc_TypeError, |
2948 | "property name should be string"); |
2949 | return NULL; |
2950 | } |
2951 | - if (!PyString_Check(v)) { |
2952 | + if (!PyUnicode_Check(v)) { |
2953 | PyErr_SetString(PyExc_TypeError, |
2954 | "property value should be string"); |
2955 | return NULL; |
2956 | } |
2957 | |
2958 | - val_string = svn_string_ncreate(PyString_AsString(v), |
2959 | - PyString_Size(v), pool); |
2960 | - apr_hash_set(hash_props, PyString_AsString(k), |
2961 | - PyString_Size(k), val_string); |
2962 | + val_string = svn_string_ncreate(_PyUnicode_AsString(v), |
2963 | + PyUnicode_GetSize(v), pool); |
2964 | + apr_hash_set(hash_props, _PyUnicode_AsString(k), |
2965 | + PyUnicode_GetSize(k), val_string); |
2966 | } |
2967 | |
2968 | return hash_props; |
2969 | @@ -507,17 +517,17 @@ |
2970 | } |
2971 | CB_CHECK_PYRETVAL(revprops); |
2972 | if (message != NULL) { |
2973 | - obj = PyString_FromString(message); |
2974 | + obj = PyUnicode_FromString(message); |
2975 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_LOG, obj); |
2976 | Py_DECREF(obj); |
2977 | } |
2978 | if (author != NULL) { |
2979 | - obj = PyString_FromString(author); |
2980 | + obj = PyUnicode_FromString(author); |
2981 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_AUTHOR, obj); |
2982 | Py_DECREF(obj); |
2983 | } |
2984 | if (date != NULL) { |
2985 | - obj = PyString_FromString(date); |
2986 | + obj = PyUnicode_FromString(date); |
2987 | PyDict_SetItemString(revprops, SVN_PROP_REVISION_DATE, obj); |
2988 | Py_DECREF(obj); |
2989 | } |
2990 | @@ -562,7 +572,7 @@ |
2991 | } |
2992 | for (i = 0; i < PyList_Size(l); i++) { |
2993 | PyObject *item = PyList_GetItem(l, i); |
2994 | - long rev = PyInt_AsLong(item); |
2995 | + long rev = PyLong_AsLong(item); |
2996 | if (rev == -1 && PyErr_Occurred()) { |
2997 | return NULL; |
2998 | } |
2999 | @@ -580,13 +590,13 @@ |
3000 | ret = PyObject_CallMethod(self, "read", "i", *length); |
3001 | CB_CHECK_PYRETVAL(ret); |
3002 | |
3003 | - if (!PyString_Check(ret)) { |
3004 | + if (!PyUnicode_Check(ret)) { |
3005 | PyErr_SetString(PyExc_TypeError, "Expected stream read function to return string"); |
3006 | PyGILState_Release(state); |
3007 | return py_svn_error(); |
3008 | } |
3009 | - *length = PyString_Size(ret); |
3010 | - memcpy(buffer, PyString_AS_STRING(ret), *length); |
3011 | + *length = PyUnicode_GetSize(ret); |
3012 | + memcpy(buffer, _PyUnicode_AsString(ret), *length); |
3013 | Py_DECREF(ret); |
3014 | PyGILState_Release(state); |
3015 | return NULL; |
3016 | @@ -678,7 +688,7 @@ |
3017 | if (ret == NULL) |
3018 | return NULL; |
3019 | if (dirent_fields & SVN_DIRENT_KIND) { |
3020 | - obj = PyInt_FromLong(dirent->kind); |
3021 | + obj = PyLong_FromLong(dirent->kind); |
3022 | PyDict_SetItemString(ret, "kind", obj); |
3023 | Py_DECREF(obj); |
3024 | } |
3025 | @@ -704,7 +714,7 @@ |
3026 | } |
3027 | if (dirent_fields & SVN_DIRENT_LAST_AUTHOR) { |
3028 | if (dirent->last_author != NULL) { |
3029 | - obj = PyString_FromString(dirent->last_author); |
3030 | + obj = PyUnicode_FromString(dirent->last_author); |
3031 | } else { |
3032 | obj = Py_None; |
3033 | Py_INCREF(obj); |
3034 | @@ -717,26 +727,50 @@ |
3035 | |
3036 | apr_file_t *apr_file_from_object(PyObject *object, apr_pool_t *pool) |
3037 | { |
3038 | - apr_status_t status; |
3039 | - FILE *file; |
3040 | - apr_file_t *fp; |
3041 | - apr_os_file_t osfile; |
3042 | - |
3043 | - file = PyFile_AsFile(object); |
3044 | + PyObject *filenameObject = NULL; |
3045 | + apr_file_t *fp = NULL; |
3046 | + apr_status_t status; |
3047 | + int fd = -1; |
3048 | + int is_filename = 0; |
3049 | + if (PyUnicode_Check(object)) { |
3050 | + is_filename = 1; |
3051 | + filenameObject = object; |
3052 | + } |
3053 | + else if ((fd = PyObject_AsFileDescriptor(object)) >= 0) { |
3054 | #ifdef WIN32 |
3055 | - osfile = (apr_os_file_t)_get_osfhandle(_fileno(file)); |
3056 | + /* apr_os_file_put is not works under Win32, so we directly retrieve |
3057 | + * filename and open it. It's also works for _ra.py_open_tmp_file |
3058 | + * under win32.*/ |
3059 | + is_filename = 1; |
3060 | + filenameObject = PyObject_GetAttrString(object, "name"); |
3061 | #else |
3062 | - osfile = (apr_os_file_t)fileno(file); |
3063 | + is_filename = 0; |
3064 | #endif |
3065 | - |
3066 | - status = apr_os_file_put(&fp, &osfile, |
3067 | - APR_FOPEN_WRITE | APR_FOPEN_CREATE, pool); |
3068 | - if (status) { |
3069 | - PyErr_SetAprStatus(status); |
3070 | - return NULL; |
3071 | - } |
3072 | - |
3073 | - return fp; |
3074 | + } |
3075 | + else |
3076 | + { |
3077 | + PyErr_SetString(PyExc_TypeError, "Unknown type for file variable"); |
3078 | + return NULL; |
3079 | + } |
3080 | + |
3081 | + if (is_filename) |
3082 | + { |
3083 | + char *filename = _PyUnicode_AsString(filenameObject); |
3084 | + status = apr_file_open(&fp, filename, |
3085 | + APR_WRITE | APR_CREATE, APR_REG, pool); |
3086 | + } |
3087 | + else |
3088 | + { |
3089 | + apr_os_file_t osfile = (apr_os_file_t)fd; |
3090 | + status = apr_os_file_put(&fp, &osfile, |
3091 | + APR_FOPEN_WRITE | APR_FOPEN_CREATE, pool); |
3092 | + } |
3093 | + if (status) { |
3094 | + PyErr_SetAprStatus(status); |
3095 | + return NULL; |
3096 | + } |
3097 | + |
3098 | + return fp; |
3099 | } |
3100 | |
3101 | static void stream_dealloc(PyObject *self) |
3102 | @@ -795,7 +829,7 @@ |
3103 | |
3104 | RUN_SVN(svn_stream_write(self->stream, buffer, &length)); |
3105 | |
3106 | - return PyInt_FromLong(length); |
3107 | + return PyLong_FromLong(length); |
3108 | } |
3109 | |
3110 | static PyObject *stream_read(StreamObject *self, PyObject *args) |
3111 | @@ -807,7 +841,7 @@ |
3112 | return NULL; |
3113 | |
3114 | if (self->closed) { |
3115 | - return PyString_FromString(""); |
3116 | + return PyBytes_FromString(""); |
3117 | } |
3118 | |
3119 | temp_pool = Pool(NULL); |
3120 | @@ -823,7 +857,7 @@ |
3121 | return NULL; |
3122 | } |
3123 | RUN_SVN_WITH_POOL(temp_pool, svn_stream_read(self->stream, buffer, &size)); |
3124 | - ret = PyString_FromStringAndSize(buffer, size); |
3125 | + ret = PyBytes_FromStringAndSize(buffer, size); |
3126 | apr_pool_destroy(temp_pool); |
3127 | return ret; |
3128 | } else { |
3129 | @@ -834,7 +868,7 @@ |
3130 | temp_pool, |
3131 | temp_pool)); |
3132 | self->closed = TRUE; |
3133 | - ret = PyString_FromStringAndSize(result->data, result->len); |
3134 | + ret = PyBytes_FromStringAndSize(result->data, result->len); |
3135 | apr_pool_destroy(temp_pool); |
3136 | return ret; |
3137 | #else |
3138 | @@ -853,7 +887,7 @@ |
3139 | }; |
3140 | |
3141 | PyTypeObject Stream_Type = { |
3142 | - PyObject_HEAD_INIT(NULL) 0, |
3143 | + PyVarObject_HEAD_INIT(NULL, 0) |
3144 | "repos.Stream", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
3145 | sizeof(StreamObject), |
3146 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
3147 | |
3148 | === modified file 'subvertpy/util.h' |
3149 | --- subvertpy/util.h 2012-02-24 06:42:47 +0000 |
3150 | +++ subvertpy/util.h 2012-04-07 06:08:21 +0000 |
3151 | @@ -20,6 +20,7 @@ |
3152 | #ifndef _SUBVERTPY_UTIL_H_ |
3153 | #define _SUBVERTPY_UTIL_H_ |
3154 | |
3155 | +#include "py_fixup.h" |
3156 | #include <svn_version.h> |
3157 | |
3158 | #if SVN_VER_MAJOR != 1 |
3159 | @@ -43,6 +44,13 @@ |
3160 | #pragma GCC visibility push(hidden) |
3161 | #endif |
3162 | |
3163 | +#if ONLY_BEFORE_SVN(1, 6) |
3164 | +#define svn_dirent_internal_style svn_path_internal_style |
3165 | +#defien svn_dirent_local_style svn_path_local_style |
3166 | +#else |
3167 | +#include <svn_dirent_uri.h> |
3168 | +#endif |
3169 | + |
3170 | svn_error_t *py_cancel_check(void *cancel_baton); |
3171 | __attribute__((warn_unused_result)) apr_pool_t *Pool(apr_pool_t *parent); |
3172 | void handle_svn_error(svn_error_t *error); |
3173 | @@ -92,7 +100,7 @@ |
3174 | apr_hash_t *config_hash_from_object(PyObject *config, apr_pool_t *pool); |
3175 | void PyErr_SetAprStatus(apr_status_t status); |
3176 | PyObject *py_dirent(const svn_dirent_t *dirent, int dirent_fields); |
3177 | -PyObject *PyOS_tmpfile(void); |
3178 | +PyObject *PyOS_tmpfile(apr_file_t** file, apr_pool_t* temp_pool); |
3179 | PyObject *pyify_changed_paths(apr_hash_t *changed_paths, bool node_kind, apr_pool_t *pool); |
3180 | #if ONLY_SINCE_SVN(1, 6) |
3181 | PyObject *pyify_changed_paths2(apr_hash_t *changed_paths2, apr_pool_t *pool); |
3182 | |
3183 | === modified file 'subvertpy/wc.c' |
3184 | --- subvertpy/wc.c 2011-11-29 02:13:41 +0000 |
3185 | +++ subvertpy/wc.c 2012-04-07 06:08:21 +0000 |
3186 | @@ -39,9 +39,9 @@ |
3187 | #define REPORTER_T svn_ra_reporter2_t |
3188 | #endif |
3189 | |
3190 | -staticforward PyTypeObject Entry_Type; |
3191 | -staticforward PyTypeObject Status_Type; |
3192 | -staticforward PyTypeObject Adm_Type; |
3193 | +static PyTypeObject Entry_Type; |
3194 | +static PyTypeObject Status_Type; |
3195 | +static PyTypeObject Adm_Type; |
3196 | |
3197 | static PyObject *py_entry(const svn_wc_entry_t *entry); |
3198 | static PyObject *py_status(const svn_wc_status2_t *status); |
3199 | @@ -125,7 +125,7 @@ |
3200 | apr_pool_t *pool; |
3201 | svn_wc_committed_queue_t *queue; |
3202 | } CommittedQueueObject; |
3203 | -staticforward PyTypeObject CommittedQueue_Type; |
3204 | +static PyTypeObject CommittedQueue_Type; |
3205 | |
3206 | #if ONLY_SINCE_SVN(1, 5) |
3207 | static svn_error_t *py_ra_report_set_path(void *baton, const char *path, svn_revnum_t revision, svn_depth_t depth, int start_empty, const char *lock_token, apr_pool_t *pool) |
3208 | @@ -136,7 +136,7 @@ |
3209 | py_lock_token = Py_None; |
3210 | Py_INCREF(py_lock_token); |
3211 | } else { |
3212 | - py_lock_token = PyString_FromString(lock_token); |
3213 | + py_lock_token = PyBytes_FromString(lock_token); |
3214 | } |
3215 | ret = PyObject_CallMethod(self, "set_path", "slbOi", path, revision, start_empty, py_lock_token, depth); |
3216 | Py_DECREF(py_lock_token); |
3217 | @@ -154,7 +154,7 @@ |
3218 | py_lock_token = Py_None; |
3219 | Py_INCREF(py_lock_token); |
3220 | } else { |
3221 | - py_lock_token = PyString_FromString(lock_token); |
3222 | + py_lock_token = PyBytes_FromString(lock_token); |
3223 | } |
3224 | ret = PyObject_CallMethod(self, "link_path", "sslbOi", path, url, revision, start_empty, py_lock_token, depth); |
3225 | Py_DECREF(py_lock_token); |
3226 | @@ -174,7 +174,7 @@ |
3227 | py_lock_token = Py_None; |
3228 | Py_INCREF(py_lock_token); |
3229 | } else { |
3230 | - py_lock_token = PyString_FromString(lock_token); |
3231 | + py_lock_token = PyBytes_FromString(lock_token); |
3232 | } |
3233 | ret = PyObject_CallMethod(self, "set_path", "slbOi", path, revision, start_empty, py_lock_token, svn_depth_infinity); |
3234 | CB_CHECK_PYRETVAL(ret); |
3235 | @@ -191,7 +191,7 @@ |
3236 | py_lock_token = Py_None; |
3237 | Py_INCREF(py_lock_token); |
3238 | } else { |
3239 | - py_lock_token = PyString_FromString(lock_token); |
3240 | + py_lock_token = PyBytes_FromString(lock_token); |
3241 | } |
3242 | ret = PyObject_CallMethod(self, "link_path", "sslbOi", path, url, revision, start_empty, py_lock_token, svn_depth_infinity); |
3243 | CB_CHECK_PYRETVAL(ret); |
3244 | @@ -274,6 +274,7 @@ |
3245 | |
3246 | static svn_error_t *py_wc_found_entry(const char *path, const svn_wc_entry_t *entry, void *walk_baton, apr_pool_t *pool) |
3247 | { |
3248 | + const char* ret_path; |
3249 | PyObject *fn, *ret; |
3250 | PyObject *callbacks = (PyObject *)walk_baton; |
3251 | PyGILState_STATE state = PyGILState_Ensure(); |
3252 | @@ -282,7 +283,8 @@ |
3253 | } else { |
3254 | fn = (PyObject *)walk_baton; |
3255 | } |
3256 | - ret = PyObject_CallFunction(fn, "sO", path, py_entry(entry)); |
3257 | + ret_path = svn_dirent_local_style(path, pool); |
3258 | + ret = PyObject_CallFunction(fn, "sO", ret_path, py_entry(entry)); |
3259 | CB_CHECK_PYRETVAL(ret); |
3260 | Py_DECREF(ret); |
3261 | PyGILState_Release(state); |
3262 | @@ -382,7 +384,7 @@ |
3263 | }; |
3264 | |
3265 | static PyTypeObject Entry_Type = { |
3266 | - PyObject_HEAD_INIT(NULL) 0, |
3267 | + PyVarObject_HEAD_INIT(NULL, 0) |
3268 | "wc.Entry", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
3269 | sizeof(EntryObject), |
3270 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
3271 | @@ -493,7 +495,7 @@ |
3272 | }; |
3273 | |
3274 | static PyTypeObject Status_Type = { |
3275 | - PyObject_HEAD_INIT(NULL) 0, |
3276 | + PyVarObject_HEAD_INIT(NULL, 0) |
3277 | "wc.Status", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
3278 | sizeof(StatusObject), |
3279 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
3280 | @@ -622,7 +624,7 @@ |
3281 | } |
3282 | Py_BEGIN_ALLOW_THREADS |
3283 | err = svn_wc_adm_open3(&ret->adm, parent_wc, |
3284 | - svn_path_canonicalize(path, ret->pool), |
3285 | + svn_dirent_internal_style(path, ret->pool), |
3286 | write_lock, depth, py_cancel_check, NULL, |
3287 | ret->pool); |
3288 | Py_END_ALLOW_THREADS |
3289 | @@ -641,7 +643,7 @@ |
3290 | { |
3291 | AdmObject *admobj = (AdmObject *)self; |
3292 | ADM_CHECK_CLOSED(admobj); |
3293 | - return PyString_FromString(svn_wc_adm_access_path(admobj->adm)); |
3294 | + return PyUnicode_FromString(svn_wc_adm_access_path(admobj->adm)); |
3295 | } |
3296 | |
3297 | static PyObject *adm_locked(PyObject *self) |
3298 | @@ -672,7 +674,7 @@ |
3299 | ret = Py_None; |
3300 | Py_INCREF(ret); |
3301 | } else { |
3302 | - ret = PyString_FromStringAndSize(value->data, value->len); |
3303 | + ret = PyUnicode_DecodeUTF8(value->data, value->len, NULL); |
3304 | } |
3305 | apr_pool_destroy(temp_pool); |
3306 | return ret; |
3307 | @@ -778,7 +780,7 @@ |
3308 | return NULL; |
3309 | #if ONLY_SINCE_SVN(1, 5) |
3310 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_walk_entries3( |
3311 | - svn_path_canonicalize(path, temp_pool), admobj->adm, |
3312 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, |
3313 | &py_wc_entry_callbacks2, (void *)callbacks, |
3314 | depth, show_hidden, py_cancel_check, NULL, |
3315 | temp_pool)); |
3316 | @@ -790,7 +792,7 @@ |
3317 | return NULL; |
3318 | } |
3319 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_walk_entries2( |
3320 | - svn_path_canonicalize(path, temp_pool), admobj->adm, |
3321 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, |
3322 | &py_wc_entry_callbacks, (void *)callbacks, |
3323 | show_hidden, py_cancel_check, NULL, |
3324 | temp_pool)); |
3325 | @@ -817,7 +819,7 @@ |
3326 | temp_pool = Pool(NULL); |
3327 | if (temp_pool == NULL) |
3328 | return NULL; |
3329 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_entry(&entry, svn_path_canonicalize(path, temp_pool), admobj->adm, show_hidden, temp_pool)); |
3330 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_entry(&entry, svn_dirent_internal_style(path, temp_pool), admobj->adm, show_hidden, temp_pool)); |
3331 | |
3332 | if (entry == NULL) { |
3333 | PyErr_Format(PyExc_KeyError, "No such entry '%s'", path); |
3334 | @@ -850,7 +852,7 @@ |
3335 | if (temp_pool == NULL) |
3336 | return NULL; |
3337 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_prop_diffs(&propchanges, &original_props, |
3338 | - svn_path_canonicalize(path, temp_pool), admobj->adm, temp_pool)); |
3339 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, temp_pool)); |
3340 | py_propchanges = PyList_New(propchanges->nelts); |
3341 | if (py_propchanges == NULL) { |
3342 | apr_pool_destroy(temp_pool); |
3343 | @@ -904,7 +906,7 @@ |
3344 | |
3345 | #if ONLY_SINCE_SVN(1, 6) |
3346 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_add3( |
3347 | - svn_path_canonicalize(path, temp_pool), admobj->adm, depth, copyfrom_url, |
3348 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, depth, copyfrom_url, |
3349 | copyfrom_rev, py_cancel_check, NULL, |
3350 | py_wc_notify_func, |
3351 | (void *)notify_func, |
3352 | @@ -916,7 +918,7 @@ |
3353 | return NULL; |
3354 | } |
3355 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_add2( |
3356 | - svn_path_canonicalize(path, temp_pool), admobj->adm, copyfrom_url, |
3357 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, copyfrom_url, |
3358 | copyfrom_rev, py_cancel_check, |
3359 | py_wc_notify_func, |
3360 | (void *)notify_func, |
3361 | @@ -1019,7 +1021,7 @@ |
3362 | return NULL; |
3363 | traversal_info = svn_wc_init_traversal_info(temp_pool); |
3364 | #if ONLY_SINCE_SVN(1, 6) |
3365 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions4(svn_path_canonicalize(path, temp_pool), admobj->adm, |
3366 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions4(svn_dirent_internal_style(path, temp_pool), admobj->adm, |
3367 | &py_ra_reporter, (void *)reporter, |
3368 | restore_files, recurse?svn_depth_infinity:svn_depth_files, |
3369 | honor_depth_exclude, |
3370 | @@ -1027,14 +1029,14 @@ |
3371 | py_wc_notify_func, (void *)notify_func, |
3372 | traversal_info, temp_pool)); |
3373 | #elif ONLY_SINCE_SVN(1, 5) |
3374 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions3(svn_path_canonicalize(path, temp_pool), admobj->adm, |
3375 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions3(svn_dirent_internal_style(path, temp_pool), admobj->adm, |
3376 | &py_ra_reporter, (void *)reporter, |
3377 | restore_files, recurse?svn_depth_infinity:svn_depth_files, |
3378 | depth_compatibility_trick, use_commit_times, |
3379 | py_wc_notify_func, (void *)notify_func, |
3380 | traversal_info, temp_pool)); |
3381 | #else |
3382 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions2(svn_path_canonicalize(path, temp_pool), admobj->adm, |
3383 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_crawl_revisions2(svn_dirent_internal_style(path, temp_pool), admobj->adm, |
3384 | &py_ra_reporter, (void *)reporter, |
3385 | restore_files, recurse, use_commit_times, |
3386 | py_wc_notify_func, (void *)notify_func, |
3387 | @@ -1142,11 +1144,11 @@ |
3388 | |
3389 | while (PyDict_Next(dict, &idx, &key, &val)) { |
3390 | svn_prop_t *prop = apr_palloc(pool, sizeof(svn_prop_t)); |
3391 | - prop->name = PyString_AsString(key); |
3392 | + prop->name = _PyUnicode_AsString(key); |
3393 | if (val == Py_None) { |
3394 | prop->value = NULL; |
3395 | } else { |
3396 | - prop->value = svn_string_ncreate(PyString_AsString(val), PyString_Size(val), pool); |
3397 | + prop->value = svn_string_ncreate(_PyUnicode_AsString(val), PyUnicode_GetSize(val), pool); |
3398 | } |
3399 | APR_ARRAY_PUSH(*ret, svn_prop_t *) = prop; |
3400 | } |
3401 | @@ -1218,7 +1220,7 @@ |
3402 | |
3403 | #if ONLY_SINCE_SVN(1, 6) |
3404 | RUN_SVN_WITH_POOL(temp_pool, svn_wc_process_committed4( |
3405 | - svn_path_canonicalize(path, temp_pool), admobj->adm, recurse, new_revnum, |
3406 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, recurse, new_revnum, |
3407 | rev_date, rev_author, wcprop_changes, |
3408 | remove_lock, remove_changelist, digest, temp_pool)); |
3409 | #else |
3410 | @@ -1227,7 +1229,7 @@ |
3411 | apr_pool_destroy(temp_pool); |
3412 | return NULL; |
3413 | } |
3414 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_process_committed3(svn_path_canonicalize(path, temp_pool), admobj->adm, recurse, new_revnum, |
3415 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_process_committed3(svn_dirent_internal_style(path, temp_pool), admobj->adm, recurse, new_revnum, |
3416 | rev_date, rev_author, wcprop_changes, |
3417 | remove_lock, digest, temp_pool)); |
3418 | #endif |
3419 | @@ -1268,9 +1270,9 @@ |
3420 | AdmObject *admobj = (AdmObject *)self; |
3421 | |
3422 | if (admobj->adm == NULL) { |
3423 | - return PyString_FromFormat("<wc.WorkingCopy (closed) at 0x%p>", admobj); |
3424 | + return PyUnicode_FromFormat("<wc.WorkingCopy (closed) at 0x%p>", admobj); |
3425 | } else { |
3426 | - return PyString_FromFormat("<wc.WorkingCopy at '%s'>", |
3427 | + return PyUnicode_FromFormat("<wc.WorkingCopy at '%s'>", |
3428 | svn_wc_adm_access_path(admobj->adm)); |
3429 | } |
3430 | } |
3431 | @@ -1674,6 +1676,7 @@ |
3432 | { |
3433 | char *path; |
3434 | const char *anchor = NULL, *target = NULL; |
3435 | + const char *ret_path = NULL; |
3436 | apr_pool_t *temp_pool; |
3437 | PyObject *ret; |
3438 | |
3439 | @@ -1685,10 +1688,11 @@ |
3440 | return NULL; |
3441 | |
3442 | RUN_SVN_WITH_POOL(temp_pool, |
3443 | - svn_wc_get_actual_target(svn_path_canonicalize(path, temp_pool), |
3444 | + svn_wc_get_actual_target(svn_dirent_internal_style(path, temp_pool), |
3445 | &anchor, &target, temp_pool)); |
3446 | |
3447 | - ret = Py_BuildValue("(ss)", anchor, target); |
3448 | + ret_path = svn_dirent_local_style(anchor, temp_pool); |
3449 | + ret = Py_BuildValue("(ss)", ret_path, target); |
3450 | |
3451 | apr_pool_destroy(temp_pool); |
3452 | |
3453 | @@ -1712,7 +1716,8 @@ |
3454 | return NULL; |
3455 | |
3456 | RUN_SVN_WITH_POOL(temp_pool, |
3457 | - svn_wc_is_wc_root(&wc_root, path, admobj->adm, temp_pool)); |
3458 | + svn_wc_is_wc_root(&wc_root, svn_dirent_internal_style(path, temp_pool), |
3459 | + admobj->adm, temp_pool)); |
3460 | |
3461 | apr_pool_destroy(temp_pool); |
3462 | |
3463 | @@ -1743,10 +1748,10 @@ |
3464 | |
3465 | RUN_SVN_WITH_POOL(temp_pool, |
3466 | svn_wc_transmit_text_deltas2(&tempfile, digest, |
3467 | - svn_path_canonicalize(path, temp_pool), admobj->adm, fulltext, |
3468 | + svn_dirent_internal_style(path, temp_pool), admobj->adm, fulltext, |
3469 | &py_editor, editor_obj, temp_pool)); |
3470 | |
3471 | - py_digest = PyString_FromStringAndSize((char *)digest, APR_MD5_DIGESTSIZE); |
3472 | + py_digest = PyBytes_FromStringAndSize((char *)digest, APR_MD5_DIGESTSIZE); |
3473 | if (py_digest == NULL) { |
3474 | apr_pool_destroy(temp_pool); |
3475 | return NULL; |
3476 | @@ -1783,7 +1788,7 @@ |
3477 | Py_INCREF(editor_obj); |
3478 | |
3479 | RUN_SVN_WITH_POOL(temp_pool, |
3480 | - svn_wc_transmit_prop_deltas(svn_path_canonicalize(path, temp_pool), |
3481 | + svn_wc_transmit_prop_deltas(svn_dirent_internal_style(path, temp_pool), |
3482 | admobj->adm, &(py_entry->entry), &py_editor, editor_obj, NULL, temp_pool)); |
3483 | |
3484 | apr_pool_destroy(temp_pool); |
3485 | @@ -1808,7 +1813,7 @@ |
3486 | return NULL; |
3487 | |
3488 | RUN_SVN_WITH_POOL(pool, svn_wc_adm_retrieve(&result, admobj->adm, |
3489 | - svn_path_canonicalize(path, pool), pool)); |
3490 | + svn_dirent_internal_style(path, pool), pool)); |
3491 | |
3492 | ret = PyObject_New(AdmObject, &Adm_Type); |
3493 | if (ret == NULL) |
3494 | @@ -1837,7 +1842,7 @@ |
3495 | return NULL; |
3496 | |
3497 | RUN_SVN_WITH_POOL(pool, svn_wc_adm_probe_retrieve(&result, admobj->adm, |
3498 | - svn_path_canonicalize(path, pool), pool)); |
3499 | + svn_dirent_internal_style(path, pool), pool)); |
3500 | |
3501 | ret = PyObject_New(AdmObject, &Adm_Type); |
3502 | if (ret == NULL) |
3503 | @@ -1868,7 +1873,7 @@ |
3504 | return NULL; |
3505 | |
3506 | RUN_SVN_WITH_POOL(pool, svn_wc_adm_probe_try3(&result, admobj->adm, |
3507 | - svn_path_canonicalize(path, pool), writelock, levels_to_lock, |
3508 | + svn_dirent_internal_style(path, pool), writelock, levels_to_lock, |
3509 | py_cancel_check, NULL, pool)); |
3510 | |
3511 | if (result == NULL) { |
3512 | @@ -2024,7 +2029,7 @@ |
3513 | RUN_SVN_WITH_POOL(temp_pool, |
3514 | svn_wc_status2( |
3515 | &st, |
3516 | - svn_path_canonicalize(svn_path_join(svn_wc_adm_access_path(admobj->adm), path, temp_pool), temp_pool), |
3517 | + svn_dirent_internal_style(svn_path_join(svn_wc_adm_access_path(admobj->adm), path, temp_pool), temp_pool), |
3518 | admobj->adm, |
3519 | temp_pool)); |
3520 | |
3521 | @@ -2068,7 +2073,7 @@ |
3522 | { "get_ancestry", (PyCFunction)get_ancestry, METH_VARARGS, |
3523 | "S.get_ancestry(path) -> (url, rev)" }, |
3524 | { "maybe_set_repos_root", (PyCFunction)maybe_set_repos_root, METH_VARARGS, "S.maybe_set_repos_root(path, repos)" }, |
3525 | - { "add_repos_file", (PyCFunction)add_repos_file, METH_KEYWORDS, |
3526 | + { "add_repos_file", (PyCFunction)add_repos_file, METH_VARARGS | METH_KEYWORDS, |
3527 | "S.add_repos_file(dst_path, new_base_contents, new_contents, new_base_props, new_props, copyfrom_url=None, copyfrom_rev=-1, notify_func=None)" }, |
3528 | { "mark_missing_deleted", (PyCFunction)mark_missing_deleted, METH_VARARGS, |
3529 | "S.mark_missing_deleted(path)" }, |
3530 | @@ -2101,7 +2106,7 @@ |
3531 | }; |
3532 | |
3533 | static PyTypeObject Adm_Type = { |
3534 | - PyObject_HEAD_INIT(NULL) 0, |
3535 | + PyVarObject_HEAD_INIT(NULL, 0) |
3536 | "wc.WorkingCopy", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
3537 | sizeof(AdmObject), |
3538 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
3539 | @@ -2180,7 +2185,7 @@ |
3540 | { |
3541 | CommittedQueueObject *cqobj = (CommittedQueueObject *)self; |
3542 | |
3543 | - return PyString_FromFormat("<wc.CommittedQueue at 0x%p>", cqobj->queue); |
3544 | + return PyUnicode_FromFormat("<wc.CommittedQueue at 0x%p>", cqobj->queue); |
3545 | } |
3546 | |
3547 | static PyObject *committed_queue_init(PyTypeObject *self, PyObject *args, PyObject *kwargs) |
3548 | @@ -2270,7 +2275,7 @@ |
3549 | }; |
3550 | |
3551 | static PyTypeObject CommittedQueue_Type = { |
3552 | - PyObject_HEAD_INIT(NULL) 0, |
3553 | + PyVarObject_HEAD_INIT(NULL, 0) |
3554 | "wc.CommittedQueue", /* const char *tp_name; For printing, in format "<module>.<name>" */ |
3555 | sizeof(CommittedQueueObject), |
3556 | 0,/* Py_ssize_t tp_basicsize, tp_itemsize; For allocation */ |
3557 | @@ -2364,7 +2369,7 @@ |
3558 | RUN_SVN_WITH_POOL(temp_pool, |
3559 | svn_wc_revision_status( |
3560 | &revstatus, |
3561 | - svn_path_canonicalize(wc_path, temp_pool), |
3562 | + svn_dirent_internal_style(wc_path, temp_pool), |
3563 | trail_url, |
3564 | committed, py_cancel_check, NULL, temp_pool)); |
3565 | ret = Py_BuildValue("(llbb)", revstatus->min_rev, revstatus->max_rev, |
3566 | @@ -2432,7 +2437,7 @@ |
3567 | if (pool == NULL) |
3568 | return NULL; |
3569 | dir = svn_wc_get_adm_dir(pool); |
3570 | - ret = PyString_FromString(dir); |
3571 | + ret = PyUnicode_FromString(dir); |
3572 | apr_pool_destroy(pool); |
3573 | return ret; |
3574 | } |
3575 | @@ -2472,9 +2477,9 @@ |
3576 | PyErr_WarnEx(PyExc_DeprecationWarning, "get_pristine_copy_path is deprecated. Use get_pristine_contents instead.", 2); |
3577 | #endif |
3578 | RUN_SVN_WITH_POOL(pool, |
3579 | - svn_wc_get_pristine_copy_path(svn_path_canonicalize(path, pool), |
3580 | + svn_wc_get_pristine_copy_path(svn_dirent_internal_style(path, pool), |
3581 | &pristine_path, pool)); |
3582 | - ret = PyString_FromString(pristine_path); |
3583 | + ret = PyUnicode_FromString(pristine_path); |
3584 | apr_pool_destroy(pool); |
3585 | return ret; |
3586 | } |
3587 | @@ -2506,7 +2511,7 @@ |
3588 | return NULL; |
3589 | } |
3590 | |
3591 | - RUN_SVN_WITH_POOL(stream_pool, svn_wc_get_pristine_contents(&stream, svn_path_canonicalize(path, temp_pool), stream_pool, temp_pool)); |
3592 | + RUN_SVN_WITH_POOL(stream_pool, svn_wc_get_pristine_contents(&stream, svn_dirent_internal_style(path, temp_pool), stream_pool, temp_pool)); |
3593 | apr_pool_destroy(temp_pool); |
3594 | |
3595 | if (stream == NULL) { |
3596 | @@ -2527,7 +2532,7 @@ |
3597 | temp_pool = Pool(NULL); |
3598 | if (temp_pool == NULL) |
3599 | return NULL; |
3600 | - RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_pristine_copy_path(svn_path_canonicalize(path, temp_pool), &pristine_path, temp_pool)); |
3601 | + RUN_SVN_WITH_POOL(temp_pool, svn_wc_get_pristine_copy_path(svn_dirent_internal_style(path, temp_pool), &pristine_path, temp_pool)); |
3602 | ret = PyFile_FromString((char *)pristine_path, "rb"); |
3603 | apr_pool_destroy(temp_pool); |
3604 | return ret; |
3605 | @@ -2552,7 +2557,7 @@ |
3606 | return NULL; |
3607 | #if ONLY_SINCE_SVN(1, 5) |
3608 | RUN_SVN_WITH_POOL(pool, |
3609 | - svn_wc_ensure_adm3(svn_path_canonicalize(path, pool), |
3610 | + svn_wc_ensure_adm3(svn_dirent_internal_style(path, pool), |
3611 | uuid, url, repos, rev, depth, pool)); |
3612 | #else |
3613 | if (depth != svn_depth_infinity) { |
3614 | @@ -2562,7 +2567,7 @@ |
3615 | return NULL; |
3616 | } |
3617 | RUN_SVN_WITH_POOL(pool, |
3618 | - svn_wc_ensure_adm2(svn_path_canonicalize(path, pool), |
3619 | + svn_wc_ensure_adm2(svn_dirent_internal_style(path, pool), |
3620 | uuid, url, repos, rev, pool)); |
3621 | #endif |
3622 | apr_pool_destroy(pool); |
3623 | @@ -2581,7 +2586,7 @@ |
3624 | pool = Pool(NULL); |
3625 | if (pool == NULL) |
3626 | return NULL; |
3627 | - RUN_SVN_WITH_POOL(pool, svn_wc_check_wc(svn_path_canonicalize(path, pool), &wc_format, pool)); |
3628 | + RUN_SVN_WITH_POOL(pool, svn_wc_check_wc(svn_dirent_internal_style(path, pool), &wc_format, pool)); |
3629 | apr_pool_destroy(pool); |
3630 | return PyLong_FromLong(wc_format); |
3631 | } |
3632 | @@ -2677,42 +2682,44 @@ |
3633 | { NULL, } |
3634 | }; |
3635 | |
3636 | -void initwc(void) |
3637 | +PyModule_Init_DEFINE(wc) |
3638 | { |
3639 | - PyObject *mod; |
3640 | + PyObject *mod = NULL; |
3641 | |
3642 | if (PyType_Ready(&Entry_Type) < 0) |
3643 | - return; |
3644 | + PyModule_RETURN(mod); |
3645 | |
3646 | if (PyType_Ready(&Status_Type) < 0) |
3647 | - return; |
3648 | + PyModule_RETURN(mod); |
3649 | |
3650 | if (PyType_Ready(&Adm_Type) < 0) |
3651 | - return; |
3652 | + PyModule_RETURN(mod); |
3653 | |
3654 | if (PyType_Ready(&Editor_Type) < 0) |
3655 | - return; |
3656 | + PyModule_RETURN(mod); |
3657 | |
3658 | if (PyType_Ready(&FileEditor_Type) < 0) |
3659 | - return; |
3660 | + PyModule_RETURN(mod); |
3661 | |
3662 | if (PyType_Ready(&DirectoryEditor_Type) < 0) |
3663 | - return; |
3664 | + PyModule_RETURN(mod); |
3665 | |
3666 | if (PyType_Ready(&TxDeltaWindowHandler_Type) < 0) |
3667 | - return; |
3668 | + PyModule_RETURN(mod); |
3669 | |
3670 | if (PyType_Ready(&Stream_Type) < 0) |
3671 | - return; |
3672 | + PyModule_RETURN(mod); |
3673 | |
3674 | if (PyType_Ready(&CommittedQueue_Type) < 0) |
3675 | - return; |
3676 | + PyModule_RETURN(mod); |
3677 | + |
3678 | + |
3679 | |
3680 | apr_initialize(); |
3681 | |
3682 | - mod = Py_InitModule3("wc", wc_methods, "Working Copies"); |
3683 | + PyModule_DEFINE(mod, "wc", "Working Copies", wc_methods) |
3684 | if (mod == NULL) |
3685 | - return; |
3686 | + PyModule_RETURN(mod); |
3687 | |
3688 | PyModule_AddIntConstant(mod, "SCHEDULE_NORMAL", 0); |
3689 | PyModule_AddIntConstant(mod, "SCHEDULE_ADD", 1); |
3690 | @@ -2773,4 +2780,5 @@ |
3691 | |
3692 | PyModule_AddObject(mod, "CommittedQueue", (PyObject *)&CommittedQueue_Type); |
3693 | Py_INCREF(&CommittedQueue_Type); |
3694 | + PyModule_RETURN(mod); |
3695 | } |
THis has a lot of conflicts.