Commit Graph

288 Commits

Author SHA1 Message Date
Dirkjan Ochtman
6b1191ea6a keep variables more local, add some whitespace 2010-10-06 15:18:05 +02:00
Dirkjan Ochtman
c6d23ef903 fix some style nits 2010-10-06 15:18:15 +02:00
Dirkjan Ochtman
8dad8599ed fix some line lengths 2010-10-06 15:18:23 +02:00
Dan Villiom Podlaski Christiansen
04eaea5235 uisetup: add fromsvn() and svnrev() revsets. 2010-10-05 16:26:19 +02:00
Dan Villiom Podlaski Christiansen
dc354599e2 wrapper: fail properly with unsupported versions of Subvertpy (fixes #212)
Calling subvertpy.wc.api_version() will raise an AttributeError with
versions of Subvertpy prior to 0.7.4. This AttributeError completely
breaks hgsubversion, as our infrastructure assumes that only
ImportErrors are raised during imports.

Delaying the call to api_version() until after the Subvertpy version
check should make things work again.
2010-10-03 17:53:20 +02:00
Dan Villiom Podlaski Christiansen
7a95293acb svnwrap: fix handling of quotable URLs (fixes #197, refs #132)
The way hgsubversion handles URLs that may or may not be quoted is
somewhat fragile. As part of fixing issue 132 in 06d89c2063a2, the
path component of URLs was always quoted. The URL has been attempted
encoded since the initial check-in.

The fix from 06d89c2063a2 was incomplete; reverting it allows us to
clone a URL with a '~' in it.[1] Encoding the URL as UTF-8 seldom
works as expected, as the default string encoding is ASCII, causing
Python to be unable to decode any URL containing an 8-bit
character.

The core problem here is that we don't know whether the URL specified
by the user is quoted or not. Rather than trying to deal with this
ourselves, we pass the problem on to Subversion. Then, we obtain the
URL from the RA instance, where it is always quoted. (It's worth
noting that the editor interface, on the other hand, always deals with
unquoted paths...)

Thus, the following invariants should apply to SubversionRepo
attributes:
- svn_url and root will always be quoted.
- subdir will always be unquoted.

Tests are added that verify that it won't affect the conversion
whether a URL is specified in quoted or unquoted form. Furthermore, a
test fixture for this is added *twice*, so that we can thoroughly test
both quoted and unquoted URLs. I'm not adding a test dedicated to
tildes in URLs; it doesn't seem necessary.

[1] Such as <https://svn.kenai.com/svn/winsw~subversion>.
2010-10-04 21:00:36 -05:00
Dan Villiom Podlaski Christiansen
799dc6ce7b help topic: cosmetic improvements.
First, use of :hg:`...` is replaced with ``hg ...``. The former syntax
isn't useful outside core Mercurial. Second, a few instances of `...`
are replaced with ``...``. The minirst parser doesn't distinguish
between the two, but using docutils, the former results italics and
the latter in fixed width text. Finally, a few extra ``...`` are added.

With these changes, we could process the help topic with rst2html and
put it somewhere appropriate on the internet.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
0cae46f932 clone: call the wrapped function (fixes #181)
This is a regression that was brought to my attention in #mercurial:
hgsubversion breaks the --update flag. The cause is that we call
hg.clone() directly rather than the original wrapped function. A
comment in 'wrapper.py' noted that the call to hg.clone() should be
kept in sync with 'mercurial/commands.py'. That didn't happen.

The original reason for calling hg.clone() directly was that we needed
its return values. Another wrapper is added (and cleared) within
clone() to get them anyway.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
d7fde1dbae tests & help: fix compatibility with Mercurial 1.4 and earlier.
The --branch option to clone, pull, etc., was introduced in 1.5, and
our handling of it assumes that Mercurial also provides it. As a
result, both documentation and the test are changed to reflect this.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
182aa26e32 svnrepo: make the svnurl property obtain the URL from Subversion.
This causes an access to the svnurl property to connect to the
repository. One of the tests uses an invalid URL, and so had to be
updated to bypass this.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
cf80fcfd04 subvertpy wrapper: check against Subversion version compiled against.
The previously used method for checking the Subversion version,
subvertpy.wc.version(), reported back the version of the runtime
library used. This is not what we're interested in; we want to know
what version it was compiled against.

These functions were not available in Subvertpy 0.7.3, necessitating
the earlier bump of the version requirement to 0.7.4.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
8c1023cd7c subvertpy wrapper: bump version requirement to 0.7.4.
0.7.4 was released on 2010-09-25 or 25 September 2010.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
d0bade927f templatekw: clean up implementation & test; add help.
The core logic is cleaned up and moved to the wrappers module. The
test made to test that it works with original Mercurial changesets, is
cleaned up so that it can be more easily extended in the
future. Finally, documentation is added for the feature.
2010-09-29 18:04:26 +02:00
Dan Villiom Podlaski Christiansen
dd4b302e9a pull: reveal the handled SubversionException to --traceback. 2010-09-14 21:03:02 +02:00
Dan Villiom Podlaski Christiansen
d624550482 subversion.rst: mention externals support limitations. 2010-09-07 14:33:56 +02:00
Dan Villiom Podlaski Christiansen
076d839f19 subversion.rst: list memory leaks in the section on limitations 2010-09-07 14:33:56 +02:00
Dan Villiom Podlaski Christiansen
37ae8de40c verify: fix verifying mapped branches. 2010-09-07 14:33:56 +02:00
Dan Villiom Podlaski Christiansen
ee6b1311b0 clone: replace the --singlebranch with overloading for --branch
Instead of adding yet another option, we take the --branch option to
mean the resulting branch name. It's stored in the branch map.
2010-09-23 16:54:27 +02:00
Dan Villiom Podlaski Christiansen
4cb42fcb70 svnwrap: improve error message when no bindings are found. 2010-09-14 15:25:45 +02:00
Dan Villiom Podlaski Christiansen
6909ff1bc2 subvertpy_wrapper: don't assume the version is a three-tuple (fixes #206)
0.7.3.1 breaks this. While at it, the capitalisation of `Subvertpy' is
made consistent, and the Subversion tag, if present, is included in
the output.
2010-09-14 21:02:49 +02:00
Peter Arrenbrecht
76a82dfc04 subvertpy: set default username/pwd as with swig
Fixes wrong user name being used for pushed commits.
2010-09-15 17:50:30 +02:00
Peter Arrenbrecht
293fa6f0e3 clone: add --singlebranch option
Allows one to specify branch name for layout=single without an external
branchmap file.
2010-09-15 17:49:27 +02:00
Peter Arrenbrecht
700d808aa5 push: simplify code for remapping rebased node ids 2010-09-10 07:50:40 +02:00
Peter Arrenbrecht
01cf3d3249 push: fix case where we get >1 revs back after svn commit
This hinges on looking not only at children(), but at descendants()
to find things.
2010-09-08 10:43:02 +02:00
Augie Fackler
371ea77f68 templatekw: restore compatibility with hg < 1.5
The templatekw module was new in 1.5 - it looks nontrivial to extend the
templater in 1.4.x and earlier, so just disable this feature on those
versions.
2010-09-06 17:08:11 -05:00
Dan Villiom Podlaski Christiansen
97cdf7efab subversion.rst: mention lack of directory tracking (see issue 202) 2010-09-03 00:35:47 +02:00
Dan Villiom Podlaski Christiansen
d7bb1d26a9 subversion.rst: fix 'typo' in help for the hgsubversion.defaultauthors option. 2010-09-03 00:35:47 +02:00
Andi Albrecht
a78b4072d4 Add svnrev, svnpath and svnuuid keyword.
Based on a patch by Wagner Bruna posted here:
http://groups.google.com/group/hgsubversion/browse_thread/thread/b3913337e021ab18
2010-09-02 21:30:17 +02:00
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
Peter Arrenbrecht
edcee72d6c svnmeta: strip all repeated slashes from subdir 2010-07-28 14:47:44 +02:00
Augie Fackler
7e4f52d9e0 Merge backout of incorrect patch. 2010-08-20 20:37:54 -05:00
Augie Fackler
d4b3e11d95 Backed out changeset a020cfb8383b
I applied the wrong version of Peter's patch.
2010-08-19 10:52:38 -05: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
Peter Arrenbrecht
7d966a6696 svnmeta: strip all repeated slashes from subdir 2010-07-27 15:26:31 +02:00
Dan Villiom Podlaski Christiansen
489ce37a15 __init__: activate & advertise the new help topic. 2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
934f019d60 help: add an rst file containing some helpful instructions
The new file contains three sections: The first one is based on the
README and contains instructions on how to use hgsubversion. The
second one mentions the most notable shortcomings of hgsubversion. The
third and final section documents how to customise hgsubversion.
2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
6c73b1f82f pull: fix shallow clone when lastest change isn't HEAD.
Previously, using `hg clone --startrev HEAD` when the actual HEAD
revision didn't touch the prefix, would cause it to report that no
changes were found. Using last_changed_rev instead of HEAD fixes
this. In order to better test this scenario, we now clone the trunk
subdirectory of all the fixtures.
2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
22ba8a8561 stupid: remove an incorrect, implicit assumption in fetch_branchrev()
The code in fetch_branchrev() could fail under relatively obscure
circumstances: it combined two strings (path & child) by concatenating
them with '/' inserted in the middle. However, convert_rev() contains
an assertion that no touched file paths start with '/'. Combined,
these two amounted to an incorrect assumption that no files where
touched within an empty branchpath.
2010-08-11 19:57:34 +02:00
Dan Villiom Podlaski Christiansen
193982913d verify: add end-of-line to ui.write() calls.
It's prettier this way.
2010-08-06 14:43:40 +02:00