Commit Graph

263 Commits

Author SHA1 Message Date
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
Dan Villiom Podlaski Christiansen
062f37ee07 clone: allow specifying a start revision.
All tests pass, including comprehensive tests.
2010-07-20 11:55:07 +02:00
Dan Villiom Podlaski Christiansen
e02a1cab32 replay: always fetch the entire first revision
The entire revision is fetched using the just-added get_revision()
wrapper.

Essentially, this allows us to begin a conversion with a non-zero
start revision. As an extra safety feature, this mode is *always* used
for the very first revision, even if no start revision is
specified. For most repositories, this shouldn't matter; the entire
revision will be fetched regardless. However, there are repositories
that currently `confuse' us, such as bzr-svn conversions, and where
this is an improvement.
2010-07-20 11:55:07 +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
24589d7f47 stupid: always fetch the entire first revision 2010-07-20 11:55:07 +02:00
Dan Villiom Podlaski Christiansen
3ab870228b maps: rename revmap.seen to revmap.youngest; add revmap.oldest. 2010-07-20 11:55:07 +02:00
Dan Villiom Podlaski Christiansen
be52ac6e81 rebuildmeta: handle mapped branch names. 2010-07-13 12:19:16 +02:00
Dan Villiom Podlaski Christiansen
b320895193 stupid: handle branch mapping. 2010-07-13 13:18:11 +02:00
Dan Villiom Podlaski Christiansen
70c8cdaf45 rebuildmeta: optimize by removing quadratic time usage
Calling ctx.children() for revision R visits all revisions greater than
R. If I remember my algorithmics right, that's O(n^2). Performing an
extra traversal, however, is O(n).

A quick benchmark on a repository ~20k revisions:
  before: 445.27s user 1.10s system
  after:    7.25s user 0.25s system

The resulting `svn' directories are exactly the same, and the tests
continue to pass.
2010-07-09 22:18:27 +02:00
Dan Villiom Podlaski Christiansen
810c369ce1 branchmap: reject empty mappings 2010-07-10 14:48:57 +02:00
Dan Villiom Podlaski Christiansen
4f810ba607 branchmap: map empty commits in replay mode. 2010-07-10 14:19:24 +02:00
Dan Villiom Podlaski Christiansen
4d552ebff1 replay/stupid: fix tagging on a branch renamed using a branch map
Previously, both convert_rev() functions used parentctx.extra() to
determine the branch to pass to meta.movetag(). This assumed that the
branch name stored in the changeset matches the internal branch. The
introduction of branch maps made this assumption unsafe, however: Now,
the Mercurial branch can be completely unrelated to the origin of the
changeset.

It turns out, however, that movetag() already has sufficient knowledge
to determine the branch. Given the hash of the new changeset to be
tagged, we walk its ancestors until we find an open changeset, which
we then know to be the originating branch. This assumes that there
were `few' commits made to the tag; an assumption I would consider
reasonable.
2010-07-11 11:46:19 +02:00
Dan Villiom Podlaski Christiansen
2573895ebf editor: convert two assertions in apply_textdelta() into raising an IOError
I noticed these in the traceback filed as issue2261 in the Mercurial
bug tracker. We should always fail in cases where the Subversion
server gives us invalid data, so using assertions is wrong.
2010-07-08 21:46:54 +02:00
Dan Villiom Podlaski Christiansen
0c389b8be9 svnmeta: improve error message in get_source_rev()
Letting a KeyError propagate when the supplied revision has no
conversion record on file isn't terribly helpful. At least not when
this KeyError merely states that the key missing is
'convert_revision'.  It's much better to preemptively check for it,
detect that it's missing, and then raise an exception with a
descriptive message.
2010-07-08 21:53:59 +02:00
James McKay
b88a6f8256 svnrepo: fix issue 187: ignore pushable bookmarks in hg 1.6
Mercurial 1.6 introduces two new methods for repo subclasses -- pushkey and
listkeys -- to support pushing/pulling bookmarks between hg repositories.
(See mpm's blog post http://www.selenic.com/blog/?p=644 for details.)

Unfortunately, these are only defined in the subclasses, and not in the repo
base class. Perhaps the bookmarks extension should also be checking the repo
for pushkeys capability by calling repo.capable('pushkey') to check.
It doesn't.

In the meantime, we can implement these ourselves.

svnrepo should declare these methods since it is derived directly from repo.
They do nothing -- listkeys merely returns an empty dictionary; pushkey
returns False; this is the behaviour of httprepo or sshrepo when the remote
end is running an earlier version of Mercurial.

svnlocalrepo should not declare these methods since it derives from a
subclass of localrepo, which already will have them, unless some other badly
behaved extensions are doing something intensely weird.
2010-07-04 18:21:20 +01:00
Augie Fackler
1d5fa230a4 push: return reasonable status codes to the end user 2010-06-27 21:18:47 -05:00
Dan Villiom Podlaski Christiansen
4ed28d7664 maps: don't set the `seen' attribute in TagMap.__init__().
This seems like something left over from copying RevMap.__init__();
the attribute does not make sense for TagMap, nor is it ever expected
to have it.
2010-06-23 11:37:03 +02:00
Dan Villiom Podlaski Christiansen
9f1cd17db5 stupid: lower patch application failure output to verbose.
There is no reason to notify all users when patches fail to apply, as
we are able to handle it internally.
2010-06-22 22:43:01 +02:00
Augie Fackler
747d8b134a wrappers: cope with remoteui move to hg (hg cset 1d4f3581cbe5) 2010-06-13 00:10:53 -05:00
Augie Fackler
f18467bb2a util: handle change to hg.parseurl from d6ca622d1122 2010-06-12 20:32:02 -05:00
Augie Fackler
c78907439a svnrepo: support new discovery module introduced in 8bff0f5944ea 2010-06-12 20:55:23 -05:00
Augie Fackler
9a684b65f0 pull: handle argspec change from a00aac92bfb9 2010-06-12 20:09:25 -05:00
Dan Villiom Podlaski Christiansen
41162d88dc svncommands: add two missing imports
Two imports used when printing tracebacks were missing. They were
easily missed as this code isn't exercised unless an exception happens
to be raised during the execution of one of the `svn' subcommands.
2010-05-15 20:33:05 +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
d7942f767d push: remove superfluous creation of a new `svnremoterepo' instance. 2010-05-12 20:16:40 +02:00