Commit Graph

36 Commits

Author SHA1 Message Date
Dan Villiom Podlaski Christiansen
7bc9b7dc45 svnwrap: add runtime override for choice of Subversion bindings
By setting the `HGSUBVERSION_BINDINGS environment variable to either
`SWIG' or `Subvertpy', the choice of bindings can be forced at
runtime. (For ease of use, the comparison is case-insensitive.)

Examples:

% HGSUBVERSION_BINDINGS=swig hg version --svn
Mercurial Distributed SCM (version 1.6+172-b25e1ced9861)
...
hgsubversion: 1.1.2+43-276742da2d85
Subversion: 1.6.12
bindings: SWIG

% HGSUBVERSION_BINDINGS=subvertpy hg version --svn
Mercurial Distributed SCM (version 1.6+172-b25e1ced9861)
...
hgsubversion: 1.1.2+43-276742da2d85
Subversion: 1.6.12
bindings: Subvertpy 0.7.4

% HGSUBVERSION_BINDINGS=none hg version --svn
Mercurial Distributed SCM (version 1.6+172-b25e1ced9861)
...
abort: cannot use hgsubversion; bindings disabled using HGSUBVERSION_BINDINGS!
2010-08-11 20:03:47 +02:00
Dan Villiom Podlaski Christiansen
6b99ad8b96 svnwrap: suggest installing Subvertpy when no bindings are present 2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
da9aad1d2b svnwrap: activate & prefer subvertpy bindings when available
All tests pass.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
6792daee4e svnwrap: add subvertpy wrapper
Subvertpy is, in many ways, a better interface to Subversion than the
SWIG bindings. It's faster, leaks less and offers a cleaner API. The
added wrapper is able to coexist with the SWIG wrapper, and not
enabled by default. In order to allow this, the wrapper adapts the
output from Subvertpy so that it is similar to the output from the
SWIG bindings. An example of this can be seen in the modules that work
with editors: the nested editors offered by Subvertpy had to be
flattened to work with our editor code.

This change does not activate the Subvertpy wrapper, yet, and thus
does not affect any functionality.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
faf346e7b2 svnwrap: improve a docstring & a comment.
The docstring for SubversionRepo was technically inaccurate; not only
do we require Subversion 1.5, but the reference to a required
parameter is inaccurate, as the parameter has a default value. (To be
fair, relying on the default value is unlikely to work...)

Part of a comment in SubversionRepo.revisions() was redundant, and
could be removed.

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
b11a1e2880 svnwrap: use decorator syntax for properties.
The original reason not to use property syntax was that it didn't work
with Python 2.3. Mercurial dropped support for it more than a year
ago...

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
9ecf2e60f4 editor: move ieditor decorator into svnwrap.
The Subvertpy wrapper will not need this decorator, and moving the
decorator into svnwrap will allow the wrapper to provide a no-op
replacement.

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
cc2a46ccb8 svnwrap: factor out a common module
The new `common' module holds code not specific to the SWIG
wrapper. Factoring it out makes providing multiple wrappers easier.

No functionality change, although imports in one test were updated.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
a9ce123185 svnwrap: s/_chunk_size/chunk_size/
The underscore prefix suggests that the chunk_size is a private
variable. There's no reason for this, so we remove it in preparation
for a refactoring.

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
97e4658b48 svnwrap: s/core.SubversionException/SubversionException/
A recent change made core.SubversionException a member of
svnwrap. Referencing it directly makes the code ever so slightly
cleaner.

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
8481d5ccec svnwrap: remove dead code
Some member functions of SubversionRepo were unused, and removing them
frees other wrappers from adding possibly incorrect implementations of
them.

Two methods, `tags_at_rev' and `_get_copy_source' were completely
unused and could easily be removed. Another two methods, `branches'
and `tags' had explicit tests for them but weren't used in the code
proper; they were removed too. The START property was unnecessary and
could be removed with a tiny refactoring.

No functionality change.
2010-08-11 19:57:35 +02:00
Dan Villiom Podlaski Christiansen
295c0a8c6d svnwrap: kill the ctypes wrapper.
The wrapper was never anywhere near functional, and with the upcoming
subvertpy wrapper, the need for it has diminished. If the
implementation is ever completed, the code can be recovered from the
history of the repository.

No functionality change.
2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
e2e9fb4206 version: mention bindings type in version
In addition, the version output has been rejiggered a bit to mention
the version of hgsubversion first.

While at it, `svn' is changed to `Subversion', as this is its the
proper name.

Before:

% hg version --svn
...
svn bindings: 1.6.12
hgsubversion: 1.1.2+45-123ac53a6343

After:

% hg version --svn
...
hgsubversion: 1.1.2+45-123ac53a6343
Subversion: 1.6.12
bindings: SWIG
2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
28d19c0d6d svnwrap: add get_revision(); a thing wrapper around ra.do_update()
This function allows us to fetch the entire contents of a revision in
a reasonably efficient manner.
2010-07-20 11:55:07 +02:00
Dan Villiom Podlaski Christiansen
3ea18817b9 svncommands: fix layering violation & tweak error messages.
Importing `SubversionException' directly from `svn.core' is a layering
violation: Anything within the Subversion bindings should only be
accessed via svnwrap.

The advantages to doing this are twofold: we only need to intercept
missing bindings in one place, and we have the option of supporting
alternate bindings. As an added bonus, the recently-added support for
intercepting missing Subversion bindings actually works.

Two error messages are tweaked to remove `It appears...' from one
error message (just blaming Subversion instead) and make both errors
include the URL in the suggested command line.
2010-05-14 20:22:32 +02:00
Dan Villiom Podlaski Christiansen
38127671b5 svnwrap: use SubversionConnectionException instead of mercurial.util.Abort
This makes svnwrap independent of Mercurial.
2010-05-14 14:21:25 +02:00
Dan Villiom Podlaski Christiansen
96678cc2bc svn_swig_wrapper: improved handling of missing or outdated bindings.
Instead of aborting with a generic message when Subversion bindings
are missing, provide a helpful message. Also, the version check is
refactored to make it easier to bump our requirements in the
future. Finally, error messages are shorten so they fit in 80 columns
along with the standard `abort: ' prefix.
2010-04-30 17:35:36 +02:00
Dan Villiom Podlaski Christiansen
05fd2cecc4 isolate all imports of Subversion modules in svnwrap.
editor: move dependancy on Subversion bindings to svnwrap package.

In the editor, this involves importing the superclass of `HgEditor' as
`svnwrap.Editor'. Additionally, the `delta.svn_txdelta_apply()'
function has been abstracted away into a simpler interface, stored in
`svnwrap.apply_txdelta()'.
2010-03-31 17:51:09 +02:00
Jonathan Kotta
4aa1d845af handle nonexistant svn repositories, fixes issue 137 2010-03-09 20:58:08 -06:00
Dirkjan Ochtman
6b15b9efbb svnwrap: save the repository root, this might be useful later on 2010-02-22 23:24:11 +01:00
Augie Fackler
2a61ed0754 svn_swig: better ImportError to suggest steps for users. 2010-02-25 20:27:00 -06:00
Patrick Mezard
b0cb0173d2 svnwrap: escape copy sources paths in commit handler 2010-01-25 13:51:22 +01:00
Patrick Mezard
469301fa64 svnwrap: drop unused fetch_all_files_to_dir() 2010-02-02 23:21:18 +01:00
Dan Villiom Podlaski Christiansen
5a94472195 Change all instantiations of IOError to set both errno and strerror. 2010-01-26 17:36:13 +01:00
Augie Fackler
58c98f67c2 paths: autoescape paths from the user
This means that users should no longer URI-encode their paths. This is
a change from the past, and may require some small changes to .hg/hgrc.
This fixes certain odd issues resulting from inconsistent handling
of URI-encoding throughout hgsubversion.
2009-12-24 13:30:08 -06:00
Afriza N. Arief
da243c0327 Do URI-encode before opening 2009-12-24 13:10:36 -06:00
Augie Fackler
b0da25dd93 Support for single-directory clones. 2009-10-16 23:33:41 -04:00
Augie Fackler
7aa1f575c0 svn_swig_wrapper: minor code cleanup. 2009-09-15 21:34:14 -04:00
Chema Cortes
10c378b177 svnwrap: properly escape URLs before giving them to libsvn_*
(patch tweaked somewhat by Augie Fackler)
2009-09-15 18:26:13 -04:00
Patrick Mezard
3cdd5ec399 svnwrappers: override svn+ssh credentials with supplied ones if any
svn+ssh URLs are special because the authentication layer is not handled by
svn, so they must contain the username to be resolved seamlessly. Until now,
credentials supplied from the command line were ignored when rewriting those
URLs. Fix that.
2009-07-18 20:44:33 -05:00
Augie Fackler
a059a4c8da urls: Make sure we preserve username in urls given to ssh. 2009-06-06 11:53:21 -05:00
Dirkjan Ochtman
2c3445fb61 Merge fetch_history_at_paths() and revisions() in svn wrappers. 2009-05-28 09:54:41 +02:00
Dan Villiom Podlaski Christiansen
4464869581 Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead. 2009-05-22 15:12:31 +02:00
Dan Villiom Podlaski Christiansen
bb2a7bf94d Use fallbacks in the wrappers for Subversion support, instead of prefixes.
The change only applies to the ambiguous URL schemes: file, http and
https. The others - svn+ssh and svn - behave the same as previously.

For http and https, the wrapping is implemented in 'svnrepo.py': Only
when the attempt to create a httprepo instance fails, will the URL
be considered for Subversion URL.

For file, the ambiguity is treated much like the Mercurial core
distinguishes bundle and directories. In this case, a directory that
looks like a Subversion repository will *not* be considered for a
Mercurial clone.

Tthe command lines are more similar to before this refactor. The only
option added to push & pull is --stupid; others are only added to
clone. Any of these options specified to clone will be added to the
generated '.hgrc'.

Also, the -r/--rev option now works for clone & push.
2009-05-20 18:38:01 +02:00
Augie Fackler
5024c1f280 Merge with crew. 2009-05-26 22:22:00 -05:00
Augie Fackler
94a7ecbe68 Reorganize to have a more conventional module structure.
This means that hgsubversion now uses absolute imports instead of
relative ones, which makes the tests more reliable.
2009-05-13 21:39:39 -05:00