[Pkg-bazaar-commits] r273 ./bzr-svn/unstable: New upstream release.
Jelmer Vernooij
jelmer at samba.org
Sun Sep 9 00:43:35 UTC 2007
------------------------------------------------------------
revno: 273
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: debian
timestamp: Sun 2007-09-09 02:43:15 +0200
message:
New upstream release.
modified:
NEWS
README
TODO
__init__.py
branch.py
commit.py
convert.py
debian/changelog
debian/copyright
errors.py
fetch.py
repository.py
revids.py
setup.py
tests/test_convert.py
tests/test_errors.py
tests/test_push.py
tests/test_transport.py
transport.py
workingtree.py
------------------------------------------------------------
revno: 220.1.182.1.258.1.2
merged: jelmer at samba.org-20070826104029-4whnonqpphmys98p
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2007-08-26 12:40:29 +0200
message:
Start working on 0.4.2.
------------------------------------------------------------
revno: 220.1.182.1.258.1.3
merged: jelmer at samba.org-20070827180454-x1u2mfvsl9efjaag
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-08-27 20:04:54 +0200
message:
Fix use of svn+ prefix to bypass SSL certificate errors.
------------------------------------------------------------
revno: 220.1.182.1.258.1.4
merged: jelmer at samba.org-20070828015414-j16whf81b711a27a
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2007-08-28 03:54:14 +0200
message:
Fix handling of invalid urls.
------------------------------------------------------------
revno: 220.1.182.1.258.1.5
merged: jelmer at samba.org-20070830014931-2bt8a5a2thsb94eb
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2007-08-30 03:49:31 +0200
message:
Make sure transports are always used synchronously.
------------------------------------------------------------
revno: 220.1.182.1.258.1.6
merged: jelmer at samba.org-20070903234709-p5uvzdh57ohzvpri
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2007-09-04 01:47:09 +0200
message:
Fix version info
------------------------------------------------------------
revno: 220.1.182.1.258.1.7
merged: jelmer at samba.org-20070904220233-4wv4pes1xlx11ovq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 00:02:33 +0200
message:
Use stop_revision.
------------------------------------------------------------
revno: 220.1.182.1.258.1.8
merged: jelmer at samba.org-20070904231112-03j4arw090f4ogzj
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 01:11:12 +0200
message:
Refactor the code for determining revisions to push.
------------------------------------------------------------
revno: 220.1.182.1.258.1.9
merged: jelmer at samba.org-20070904232244-p6oekhw6mleayx4j
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 01:22:44 +0200
message:
Avoid deprecated BzrDir.create_repository().
------------------------------------------------------------
revno: 220.1.182.1.258.1.10
merged: jelmer at samba.org-20070905001031-un5bylczapfoprf2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 02:10:31 +0200
message:
Fix pushing of revisions of which only a non-left hand side parent
is present in the Subversion repository.
------------------------------------------------------------
revno: 220.1.182.1.258.1.11
merged: jelmer at samba.org-20070905005825-mhh09lg4q0t66bxw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 02:58:25 +0200
message:
Fix backing url hack (#137176).
------------------------------------------------------------
revno: 220.1.182.1.258.1.12
merged: jelmer at samba.org-20070905013414-o2lzxuofdsy17022
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 03:34:14 +0200
message:
Avoid doing a lot of has_revision() calls.
------------------------------------------------------------
revno: 220.1.182.1.258.1.13
merged: jelmer at samba.org-20070905015235-vnwlr599feewha90
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 03:52:35 +0200
message:
Move some asserts to the right places.
------------------------------------------------------------
revno: 220.1.182.1.258.1.14
merged: jelmer at samba.org-20070905020204-ff7mxmecetou5sxp
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 04:02:04 +0200
message:
Handle Unknown hostname errors correctly.
------------------------------------------------------------
revno: 220.1.182.1.258.1.15
merged: jelmer at samba.org-20070905165350-420j1pvy6cvwe6dl
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 18:53:50 +0200
message:
Handle files of which path didn't change but parent did when pushing. (#137455).
------------------------------------------------------------
revno: 220.1.182.1.258.1.16
merged: jelmer at samba.org-20070905171543-b63e3nts40on4c7l
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2007-09-05 19:15:43 +0200
message:
Update required versions.
------------------------------------------------------------
revno: 220.1.182.1.258.1.17
merged: jelmer at samba.org-20070906003319-vget8pmuu7oua7q1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Thu 2007-09-06 02:33:19 +0200
message:
Remove accidently committed pdb usage.
------------------------------------------------------------
revno: 220.1.182.1.258.1.18
merged: jelmer at samba.org-20070907114239-tig14tp0h10idyzv
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2007-09-07 13:42:39 +0200
message:
Make sure the right backend is recorded.
------------------------------------------------------------
revno: 220.1.182.1.258.1.19
merged: jelmer at samba.org-20070907114921-68niykm5eg8wezmn
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Fri 2007-09-07 13:49:21 +0200
message:
Fix sqlite index that was causing indexing errors when a repository contains multiple copies of a single revision.
------------------------------------------------------------
revno: 220.1.182.1.258.1.20
merged: jelmer at samba.org-20070907230307-xbvt3tgs3w2qb2je
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2007-09-08 01:03:07 +0200
message:
Support author argument.
------------------------------------------------------------
revno: 220.1.182.1.258.1.21
merged: jelmer at samba.org-20070908225557-0ivsn7n4owdbk3c9
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2007-09-09 00:55:57 +0200
message:
Fix compatibility with 0.90.
------------------------------------------------------------
revno: 220.1.182.1.258.1.22
merged: jelmer at samba.org-20070909004131-j4rdbl4nizucf8zg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2007-09-09 02:41:31 +0200
message:
release 0.4.2
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-08-26 10:39:49 +0000
+++ b/NEWS 2007-09-09 00:43:15 +0000
@@ -1,3 +1,28 @@
+bzr-svn 0.4.2 2007-09-09
+
+ BUG FIXES
+
+ * Fix regression that prevented the "svn+" prefix trick from working.
+
+ * Export version information so the version is displayed properly
+ in "bzr plugins".
+
+ * Avoid deprecated static BzrDir.create_repository().
+
+ * Fix pushing of revisions of which only a non-left hand side parent
+ is present in the Subversion repository. (#131692)
+
+ * Fix some problems pushing to HTTP repositories because of
+ the backing URL hack introduced to fix #80553. (#137176)
+
+ * Display unknown hostname errors properly without tracebacks.
+
+ * Handle files of which path didn't change but parent did when pushing.
+ (#137455)
+
+ * Fix sqlite index that was causing indexing errors when a repository
+ contains multiple copies of a single revision.
+
bzr-svn 0.4.1 2007-08-26
BUG FIXES
=== modified file 'README'
--- a/README 2007-08-26 10:23:08 +0000
+++ b/README 2007-09-09 00:43:15 +0000
@@ -14,12 +14,12 @@
Dependencies
============
-You will need at least version 0.15 of Bazaar or higher.
+You will need at least version 0.90 of Bazaar or higher.
You also need a fairly recent version of the Python bindings to the
Subversion libraries. At the moment, the svn plugin only works with
Subversion 1.5 (trunk). The python-subversion package in Ubuntu Feisty and
-Gutsy and Debian Etch and Sid also contain the required changes.
+Gutsy and Debian Etch, Lenny and Sid also contain the required changes.
If you are running an older version of Python (under 2.5), you will also
need to have the pysqlite package installed.
=== modified file 'TODO'
--- a/TODO 2007-08-26 10:23:08 +0000
+++ b/TODO 2007-09-09 00:43:15 +0000
@@ -1,6 +1,3 @@
-before 0.4.1:
-- track moving branch parents (#131180)
-
todo:
- generate deltas rather than fulltexts when creating file id maps
- BzrDir.create_branch() should set the revision id to NULL_REVISION
=== modified file '__init__.py'
--- a/__init__.py 2007-08-26 10:39:49 +0000
+++ b/__init__.py 2007-09-09 00:43:15 +0000
@@ -36,7 +36,15 @@
# versions ending in 'exp' mean experimental mappings
# versions ending in 'dev' mean development version
-__version__ = '0.4.1'
+# versions ending in 'final' mean release (well tested, etc)
+version_info = (0, 4, 2, 'final', 0)
+
+if version_info[3] == 'final':
+ version_string = '%d.%d.%d' % version_info[:3]
+else:
+ version_string = '%d.%d.%d%s%d' % version_info
+__version__ = version_string
+
COMPATIBLE_BZR_VERSIONS = [(0, 90)]
def check_bzrlib_version(desired):
@@ -66,7 +74,7 @@
def check_bzrsvn_version():
"""Warn about use of experimental mappings."""
- if __version__.endswith("exp"):
+ if version_info[3] == "exp":
warning('version of bzr-svn is experimental; output may change between revisions')
def check_subversion_version():
=== modified file 'branch.py'
--- a/branch.py 2007-08-26 10:23:08 +0000
+++ b/branch.py 2007-09-09 00:43:15 +0000
@@ -21,6 +21,7 @@
from bzrlib.errors import (NoSuchFile, DivergedBranches, NoSuchRevision,
NotBranchError)
from bzrlib.inventory import (Inventory)
+from bzrlib.revision import ensure_null
from bzrlib.workingtree import WorkingTree
import svn.client, svn.core
@@ -190,15 +191,14 @@
def _generate_revision_history(self, last_revnum):
"""Generate the revision history up until a specified revision."""
- self._revision_history = []
+ revhistory = []
for (branch, rev) in self.repository.follow_branch(
self.get_branch_path(last_revnum), last_revnum, self.scheme):
- self._revision_history.append(
+ revhistory.append(
self.repository.generate_revision_id(rev, branch,
str(self.scheme)))
- self._revision_history.reverse()
- self._revision_history_revnum = last_revnum
- self.repository.revmap.insert_revision_history(self._revision_history)
+ revhistory.reverse()
+ return revhistory
def _get_nick(self):
"""Find the nick name for this branch.
@@ -256,7 +256,9 @@
last_revnum = self.get_revnum()
if (self._revision_history is None or
self._revision_history_revnum != last_revnum):
- self._generate_revision_history(last_revnum)
+ self._revision_history = self._generate_revision_history(last_revnum)
+ self._revision_history_revnum = last_revnum
+ self.repository.revmap.insert_revision_history(self._revision_history)
return self._revision_history
def last_revision(self):
@@ -270,13 +272,13 @@
self.get_branch_path(), last_revnum, self.scheme):
return self.repository.generate_revision_id(rev, branch,
str(self.scheme))
- return None
+ return NULL_REVISION
ph = self.revision_history(last_revnum)
if ph:
return ph[-1]
else:
- return None
+ return NULL_REVISION
def pull(self, source, overwrite=False, stop_revision=None,
_hook_master=None, run_hooks=True):
@@ -333,26 +335,27 @@
def update_revisions(self, other, stop_revision=None):
"""See Branch.update_revisions()."""
+ if stop_revision is None:
+ stop_revision = ensure_null(other.last_revision())
if (self.last_revision() == stop_revision or
self.last_revision() == other.last_revision()):
return
- if isinstance(other, SvnBranch) and \
- other.repository.uuid == self.repository.uuid:
- # FIXME: Make sure branches haven't diverged
- # FIXME: svn.ra.del_dir(self.base_path)
- # FIXME: svn.ra.copy_dir(other.base_path, self.base_path)
- raise NotImplementedError(self.pull)
- else:
- # TODO: Use stop_revision
- todo = self.missing_revisions(other)
- pb = ui.ui_factory.nested_progress_bar()
- try:
- for rev_id in todo:
- pb.update("pushing revisions", todo.index(rev_id),
- len(todo))
- push(self, other, rev_id)
- finally:
- pb.finished()
+ if not other.repository.get_graph().is_ancestor(self.last_revision(),
+ stop_revision):
+ if self.repository.get_graph().is_ancestor(stop_revision,
+ self.last_revision()):
+ return
+ raise DivergedBranches(self, other)
+ todo = self.repository.lhs_missing_revisions(other.revision_history(),
+ stop_revision)
+ pb = ui.ui_factory.nested_progress_bar()
+ try:
+ for revid in todo:
+ pb.update("pushing revisions", todo.index(revid),
+ len(todo))
+ push(self, other, revid)
+ finally:
+ pb.finished()
def lock_write(self):
"""See Branch.lock_write()."""
=== modified file 'commit.py'
--- a/commit.py 2007-08-26 10:23:08 +0000
+++ b/commit.py 2007-09-09 00:43:15 +0000
@@ -83,7 +83,11 @@
# Gather information about revision on top of which the commit is
# happening
- (self.base_revno, self.base_revid) = self.branch.last_revision_info()
+ if parents == []:
+ self.base_revid = None
+ else:
+ self.base_revid = parents[0]
+ self.base_revno = self.branch.revision_id_to_revno(self.base_revid)
if self.base_revid is None:
self.base_revnum = -1
self.base_path = None
@@ -256,7 +260,8 @@
# copy if they existed at different location
- elif self.old_inv.id2path(child_ie.file_id) != new_child_path:
+ elif (self.old_inv.id2path(child_ie.file_id) != new_child_path or
+ self.old_inv[child_ie.file_id].parent_id != child_ie.parent_id):
self.mutter('copy %s %r -> %r' % (child_ie.kind,
self.old_inv.id2path(child_ie.file_id),
new_child_path))
@@ -555,55 +560,6 @@
builder.finish_inventory()
-def push_as_merged(target, source, revision_id):
- """Push a revision as merged revision.
-
- This will create a new revision in the target repository that
- merges the specified revision but does not contain any other differences.
- This is done so that the revision that is being pushed does not need
- to completely match the target revision and so it can not have the
- same revision id.
-
- :param target: Repository to push to
- :param source: Repository to pull the revision from
- :param revision_id: Revision id of the revision to push
- :return: The revision id of the created revision
- """
- assert isinstance(source, Branch)
- rev = source.repository.get_revision(revision_id)
-
- # revision on top of which to commit
- prev_revid = target.last_revision()
-
- mutter('committing %r on top of %r' % (revision_id, prev_revid))
-
- old_tree = source.repository.revision_tree(revision_id)
- if source.repository.has_revision(prev_revid):
- base_tree = source.repository.revision_tree(prev_revid)
- else:
- base_tree = target.repository.revision_tree(prev_revid)
-
- builder = SvnCommitBuilder(target.repository, target,
- [revision_id, prev_revid],
- target.get_config(),
- None,
- None,
- None,
- rev.properties,
- None,
- base_tree.inventory)
-
- builder.new_inventory = source.repository.get_inventory(revision_id)
- replay_delta(builder, base_tree, old_tree)
-
- try:
- return builder.commit(rev.message)
- except SubversionException, (_, num):
- if num == svn.core.SVN_ERR_FS_TXN_OUT_OF_DATE:
- raise DivergedBranches(source, target)
- raise
-
-
def push_new(target_repository, target_branch_path, source,
stop_revision=None, validate=False):
"""Push a revision into Subversion, creating a new branch.
@@ -643,6 +599,11 @@
"""See Branch.get_config()."""
return None
+ def revision_id_to_revno(self, revid):
+ if revid is None:
+ return 0
+ return history.index(revid)
+
def last_revision_info(self):
"""See Branch.last_revision_info()."""
last_revid = self.last_revision()
@@ -686,7 +647,10 @@
mutter('pushing %r' % (revision_id))
rev = source.repository.get_revision(revision_id)
- base_revid = target.last_revision()
+ if rev.parent_ids == []:
+ base_revid = None
+ else:
+ base_revid = rev.parent_ids[0]
# revision on top of which to commit
assert (base_revid in rev.parent_ids or
@@ -735,7 +699,7 @@
"""See InterRepository._get_repo_format_to_test()."""
return None
- def copy_content(self, revision_id=None, basis=None, pb=None):
+ def copy_content(self, revision_id=None, pb=None):
"""See InterRepository.copy_content."""
assert revision_id is not None, "fetching all revisions not supported"
# Go back over the LHS parent until we reach a revid we know
=== modified file 'convert.py'
--- a/convert.py 2007-08-26 10:23:08 +0000
+++ b/convert.py 2007-09-09 00:43:15 +0000
@@ -19,6 +19,7 @@
from bzrlib.branch import Branch
from bzrlib.errors import (BzrError, NotBranchError, NoSuchFile,
NoRepositoryPresent, NoSuchRevision)
+from bzrlib.revision import ensure_null
from bzrlib.transport import get_transport
from format import get_rich_root_format
@@ -160,8 +161,9 @@
# source_branch. If that is not the case,
# assume that source_branch has been replaced
# and remove target_branch
- if not source_graph.is_ancestor(target_branch.last_revision(),
- source_branch.last_revision()):
+ if not source_graph.is_ancestor(
+ ensure_null(target_branch.last_revision()),
+ ensure_null(source_branch.last_revision())):
target_branch.set_revision_history([])
target_branch.pull(source_branch)
if working_trees and not target_dir.has_workingtree():
=== modified file 'debian/changelog'
--- a/debian/changelog 2007-08-26 10:23:08 +0000
+++ b/debian/changelog 2007-09-09 00:43:15 +0000
@@ -1,3 +1,9 @@
+bzr-svn (0.4.2-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Jelmer Vernooij <jelmer at samba.org> Sun, 09 Sep 2007 02:42:37 +0200
+
bzr-svn (0.4.1-1) unstable; urgency=low
* New upstream release.
=== modified file 'debian/copyright'
--- a/debian/copyright 2006-10-09 03:04:14 +0000
+++ b/debian/copyright 2007-09-09 00:43:15 +0000
@@ -3,7 +3,7 @@
It was downloaded from http://people.samba.org/bzr/jelmer/bzr-svn/.
-Copyright 2005-2006 Jelmer Vernooij.
+Copyright 2005-2007 Jelmer Vernooij.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
=== modified file 'errors.py'
--- a/errors.py 2007-08-26 10:23:08 +0000
+++ b/errors.py 2007-09-09 00:43:15 +0000
@@ -15,13 +15,16 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Subversion-specific errors and conversion of Subversion-specific errors."""
-from bzrlib.errors import (BzrError, ConnectionReset, LockError,
- NotBranchError, PermissionDenied,
+from bzrlib.errors import (BzrError, ConnectionError, ConnectionReset,
+ LockError, NotBranchError, PermissionDenied,
DependencyNotPresent, NoRepositoryPresent,
UnexpectedEndOfContainerError)
import svn.core
+# APR define, not in svn.core
+SVN_ERR_UNKNOWN_HOSTNAME = 670002
+
class NotSvnBranchPath(NotBranchError):
"""Error raised when a path was specified that did not exist."""
_fmt = """%(path)s is not a valid Subversion branch path.
@@ -55,6 +58,8 @@
return PermissionDenied('.', msg)
elif num == svn.core.SVN_ERR_INCOMPLETE_DATA:
return UnexpectedEndOfContainerError()
+ elif num == SVN_ERR_UNKNOWN_HOSTNAME:
+ return ConnectionError(msg=msg)
else:
return err
=== modified file 'fetch.py'
--- a/fetch.py 2007-08-26 10:23:08 +0000
+++ b/fetch.py 2007-09-09 00:43:15 +0000
@@ -401,9 +401,8 @@
parents[prev_revid] = None
return (needed, parents)
- def copy_content(self, revision_id=None, basis=None, pb=None):
+ def copy_content(self, revision_id=None, pb=None):
"""See InterRepository.copy_content."""
- # FIXME: Use basis
# Dictionary with paths as keys, revnums as values
# Loop over all the revnums until revision_id
@@ -463,7 +462,10 @@
edit, edit_baton = svn.delta.make_editor(editor, pool)
if parent_revid is None:
- transport.reparent(urlutils.join(repos_root, branch))
+ branch_url = urlutils.join(repos_root, branch)
+ transport.reparent(branch_url)
+ assert transport.svn_url == branch_url.rstrip("/"), \
+ "Expected %r, got %r" % (transport.svn_url, branch_url)
reporter = transport.do_update(
revnum, True, edit, edit_baton, pool)
=== modified file 'repository.py'
--- a/repository.py 2007-08-26 10:23:08 +0000
+++ b/repository.py 2007-09-09 00:43:15 +0000
@@ -18,8 +18,8 @@
import bzrlib
from bzrlib import osutils, ui
from bzrlib.branch import BranchCheckResult
-from bzrlib.errors import (InvalidRevisionId, NoSuchRevision,
- NotBranchError, UninitializableFormat)
+from bzrlib.errors import (InvalidRevisionId, NoSuchRevision, NotBranchError,
+ UninitializableFormat, UnrelatedBranches)
from bzrlib.inventory import Inventory
from bzrlib.lockable_files import LockableFiles, TransportLock
from bzrlib.repository import Repository, RepositoryFormat
@@ -303,6 +303,16 @@
self.revmap = RevidMap(self.cachedb)
self._scheme = None
self._hinted_branch_path = branch_path
+
+ def lhs_missing_revisions(self, revhistory, stop_revision):
+ missing = []
+ slice = revhistory[:revhistory.index(stop_revision)+1]
+ for revid in reversed(slice):
+ if self.has_revision(revid):
+ missing.reverse()
+ return missing
+ missing.append(revid)
+ raise UnrelatedBranches()
def get_transaction(self):
raise NotImplementedError(self.get_transaction)
=== modified file 'revids.py'
--- a/revids.py 2007-08-09 14:54:13 +0000
+++ b/revids.py 2007-09-07 11:49:21 +0000
@@ -89,7 +89,7 @@
create table if not exists revmap (revid text, path text, min_revnum integer, max_revnum integer, scheme text);
create index if not exists revid on revmap (revid);
create unique index if not exists revid_path_scheme on revmap (revid, path, scheme);
- create unique index if not exists lookup_branch_revnum on revmap (max_revnum, min_revnum, path, scheme);
+ create index if not exists lookup_branch_revnum on revmap (max_revnum, min_revnum, path, scheme);
create table if not exists revno_cache (revid text unique, dist_to_origin integer);
create index if not exists revid on revno_cache (revid);
""")
=== modified file 'setup.py'
--- a/setup.py 2007-08-26 10:23:08 +0000
+++ b/setup.py 2007-09-09 00:43:15 +0000
@@ -5,7 +5,7 @@
setup(name='bzr-svn',
description='Support for Subversion branches in Bazaar',
keywords='plugin bzr svn',
- version='0.4.1',
+ version='0.4.2',
url='http://bazaar-vcs.org/BzrForeignBranches/Subversion',
download_url='http://bazaar-vcs.org/BzrSvn',
license='GPL',
=== modified file 'tests/test_convert.py'
--- a/tests/test_convert.py 2007-08-26 10:23:08 +0000
+++ b/tests/test_convert.py 2007-09-09 00:43:15 +0000
@@ -133,8 +133,8 @@
self.assertFalse(os.path.exists("e/branches/anotherbranch"))
def test_shared_import_continue(self):
- BzrDir.create_repository("e", shared=True,
- format=get_rich_root_format())
+ dir = BzrDir.create("e", format=get_rich_root_format())
+ dir.create_repository(shared=True)
convert_repository(Repository.open("svn+"+self.repos_url), "e",
TrunkBranchingScheme(), True)
@@ -160,14 +160,15 @@
TrunkBranchingScheme(), working_trees=True)
def test_shared_import_nonescheme_empty(self):
- BzrDir.create_repository("e", shared=True, format=get_rich_root_format())
+ dir = BzrDir.create("e", format=get_rich_root_format())
+ dir.create_repository(shared=True)
convert_repository(Repository.open("svn+"+self.repos_url), "e",
NoBranchingScheme(), True)
def test_shared_import_with_wt(self):
- BzrDir.create_repository("e", shared=True,
- format=get_rich_root_format())
+ dir = BzrDir.create("e", format=get_rich_root_format())
+ dir.create_repository(shared=True)
convert_repository(Repository.open("svn+"+self.repos_url), "e",
TrunkBranchingScheme(), True, True)
@@ -176,8 +177,8 @@
self.test_dir, "e", "trunk", "file")))
def test_shared_import_without_wt(self):
- BzrDir.create_repository("e", shared=True,
- format=get_rich_root_format())
+ dir = BzrDir.create("e", format=get_rich_root_format())
+ dir.create_repository(shared=True)
convert_repository(Repository.open("svn+"+self.repos_url), "e",
TrunkBranchingScheme(), True, False)
@@ -186,8 +187,8 @@
self.test_dir, "e", "trunk", "file")))
def test_shared_import_old_repos_fails(self):
- BzrDir.create_repository("e", shared=True,
- format=format_registry.make_bzrdir('knit'))
+ dir = BzrDir.create("e", format=format_registry.make_bzrdir('knit'))
+ dir.create_repository(shared=True)
self.assertRaises(IncompatibleRepositories,
lambda: convert_repository(Repository.open(self.repos_url), "e",
=== modified file 'tests/test_errors.py'
--- a/tests/test_errors.py 2007-08-25 12:27:03 +0000
+++ b/tests/test_errors.py 2007-09-05 02:02:04 +0000
@@ -14,11 +14,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from bzrlib.errors import (ConnectionReset, LockError, PermissionDenied,
- UnexpectedEndOfContainerError)
+from bzrlib.errors import (ConnectionError, ConnectionReset, LockError,
+ PermissionDenied, UnexpectedEndOfContainerError)
from bzrlib.tests import TestCase
-from errors import convert_svn_error, convert_error, InvalidPropertyValue
+from errors import (convert_svn_error, convert_error, InvalidPropertyValue,
+ SVN_ERR_UNKNOWN_HOSTNAME)
import svn.core
from svn.core import SubversionException
@@ -54,6 +55,9 @@
def test_convert_unexpected_end(self):
self.assertIsInstance(convert_error(SubversionException("Unexpected end of stream", svn.core.SVN_ERR_INCOMPLETE_DATA)), UnexpectedEndOfContainerError)
+ def test_convert_unknown_hostname(self):
+ self.assertIsInstance(convert_error(SubversionException("Unknown hostname 'bla'", SVN_ERR_UNKNOWN_HOSTNAME)), ConnectionError)
+
def test_decorator_nothrow(self):
@convert_svn_error
def test_nothrow(foo):
=== modified file 'tests/test_push.py'
--- a/tests/test_push.py 2007-08-06 06:57:49 +0000
+++ b/tests/test_push.py 2007-09-06 00:33:19 +0000
@@ -26,7 +26,7 @@
import os
import format
import svn.core
-from commit import push, push_as_merged
+from commit import push
from repository import MAPPING_VERSION, SVN_PROP_BZR_REVISION_ID
from revids import generate_svn_revision_id
from tests import TestCaseWithSubversionRepository
@@ -207,34 +207,6 @@
self.assertEqual(rev1.message, rev2.message)
self.assertEqual(rev1.revision_id, rev2.revision_id)
- def test_multiple_merged(self):
- self.build_tree({'dc/file': 'data'})
- wt = self.bzrdir.open_workingtree()
- wt.add('file')
- wt.commit(message="Commit from Bzr")
-
- self.build_tree({'dc/file': 'data2', 'dc/adir': None})
- wt.add('adir')
- wt.commit(message="Another commit from Bzr")
-
- push_as_merged(self.svndir.open_branch(),
- self.bzrdir.open_branch(),
- self.bzrdir.open_branch().last_revision())
-
- repos = self.svndir.find_repository()
-
- self.assertEqual(
- generate_svn_revision_id(self.svndir.find_repository().uuid, 2, "", "none"),
- self.svndir.open_branch().last_revision())
-
- inv = repos.get_inventory(repos.generate_revision_id(2, "", "none"))
- self.assertTrue(inv.has_filename('file'))
- self.assertTrue(inv.has_filename('adir'))
-
- self.assertEqual([repos.generate_revision_id(1, "", "none"),
- self.bzrdir.open_branch().last_revision()],
- repos.revision_parents(repos.generate_revision_id(2, "", "none")))
-
def test_multiple(self):
self.build_tree({'dc/file': 'data'})
wt = self.bzrdir.open_workingtree()
@@ -414,3 +386,64 @@
os.mkdir("n")
BzrDir.open(repos_url+"/trunk").sprout("n")
+ def test_push_non_lhs_parent(self):
+ repos_url = self.make_client("a", "dc")
+ bzrwt = BzrDir.create_standalone_workingtree("c",
+ format=format.get_rich_root_format())
+ self.build_tree({'c/registry/generic.c': "Tour"})
+ bzrwt.add("registry")
+ bzrwt.add("registry/generic.c")
+ revid1 = bzrwt.commit("Add initial directory + file", rev_id="initialrevid")
+
+ # Push first branch into Subversion
+ newdir = BzrDir.open(repos_url+"/trunk")
+ newbranch = newdir.import_branch(bzrwt.branch)
+
+ # Should create dc/trunk
+ self.client_update("dc")
+
+ self.build_tree({'dc/branches': None})
+ self.client_add("dc/branches")
+ self.client_copy("dc/trunk", "dc/branches/foo")
+ self.client_commit("dc", "Copy branches")
+ self.client_update("dc")
+
+ self.build_tree({'dc/branches/foo/registry/generic.c': "France"})
+ merge_revno = self.client_commit("dc", "Change copied branch")[0]
+ merge_revid = newdir.find_repository().generate_revision_id(merge_revno, "branches/foo", "trunk0")
+
+ self.build_tree({'c/registry/generic.c': "de"})
+ revid2 = bzrwt.commit("Change something", rev_id="changerevid")
+
+ # Merge
+ self.build_tree({'c/registry/generic.c': "France"})
+ bzrwt.add_pending_merge(merge_revid)
+ revid3 = bzrwt.commit("Merge something", rev_id="mergerevid")
+
+ trunk = Branch.open(repos_url + "/branches/foo")
+ trunk.pull(bzrwt.branch)
+
+ self.assertEquals([revid1, revid2, revid3], trunk.revision_history())
+
+ def test_complex_replace_dir(self):
+ repos_url = self.make_client("a", "dc")
+ bzrwt = BzrDir.create_standalone_workingtree("c",
+ format=format.get_rich_root_format())
+ self.build_tree({'c/registry/generic.c': "Tour"})
+ bzrwt.add(["registry"], ["origdir"])
+ bzrwt.add(["registry/generic.c"], ["file"])
+ revid1 = bzrwt.commit("Add initial directory + file")
+
+ bzrwt.remove('registry/generic.c')
+ bzrwt.remove('registry')
+ bzrwt.add(["registry"], ["newdir"])
+ bzrwt.add(["registry/generic.c"], ["file"])
+ revid2 = bzrwt.commit("Do some funky things")
+
+ newdir = BzrDir.open(repos_url+"/trunk")
+ newbranch = newdir.import_branch(bzrwt.branch)
+ self.assertEquals(revid2, newbranch.last_revision())
+ self.assertEquals([revid1, revid2], newbranch.revision_history())
+
+ os.mkdir("n")
+ BzrDir.open(repos_url+"/trunk").sprout("n")
=== modified file 'tests/test_transport.py'
--- a/tests/test_transport.py 2007-08-26 10:23:08 +0000
+++ b/tests/test_transport.py 2007-09-09 00:43:15 +0000
@@ -17,7 +17,7 @@
"""Subversion transport tests."""
from tests import TestCaseWithSubversionRepository
-from bzrlib.errors import NotBranchError, NoSuchFile, FileExists
+from bzrlib.errors import NotBranchError, NoSuchFile, FileExists, InvalidURL
from transport import SvnRaTransport, bzr_to_svn_url
from unittest import TestCase
@@ -25,7 +25,7 @@
class SvnRaTest(TestCaseWithSubversionRepository):
def test_open_nonexisting(self):
- self.assertRaises(NotBranchError, SvnRaTransport,
+ self.assertRaises(InvalidURL, SvnRaTransport,
"svn+nonexisting://foo/bar")
def test_create(self):
=== modified file 'transport.py'
--- a/transport.py 2007-08-26 10:23:08 +0000
+++ b/transport.py 2007-09-09 00:43:15 +0000
@@ -17,7 +17,7 @@
from bzrlib import debug, urlutils
from bzrlib.errors import (NoSuchFile, NotBranchError, TransportNotPossible,
- FileExists, NotLocalUrl)
+ FileExists, NotLocalUrl, InvalidURL)
from bzrlib.trace import mutter
from bzrlib.transport import Transport
@@ -73,12 +73,27 @@
return url.rstrip('/')
+def needs_busy(unbound):
+ """Decorator that marks a transport as busy before running a methd on it.
+ """
+ def convert(self, *args, **kwargs):
+ self._mark_busy()
+ ret = unbound(self, *args, **kwargs)
+ self._unmark_busy()
+ return ret
+
+ convert.__doc__ = unbound.__doc__
+ convert.__name__ = unbound.__name__
+ return convert
+
+
class Editor:
"""Simple object wrapper around the Subversion delta editor interface."""
- def __init__(self, (editor, editor_baton)):
+ def __init__(self, transport, (editor, editor_baton)):
self.editor = editor
self.editor_baton = editor_baton
self.recent_baton = []
+ self._transport = transport
@convert_svn_error
def open_root(self, base_revnum):
@@ -98,6 +113,7 @@
def close(self):
assert self.recent_baton == []
svn.delta.editor_invoke_close_edit(self.editor, self.editor_baton)
+ self._transport._unmark_busy()
@convert_svn_error
def apply_textdelta(self, baton, *args, **kwargs):
@@ -188,19 +204,32 @@
except SubversionException, (_, num):
if num in (svn.core.SVN_ERR_RA_SVN_REPOS_NOT_FOUND,):
raise NoSvnRepositoryPresent(url=url)
+ if num == svn.core.SVN_ERR_BAD_URL:
+ raise InvalidURL(url)
raise
from bzrlib.plugins.svn import lazy_check_versions
lazy_check_versions()
+ self._busy = False
+
+ def _mark_busy(self):
+ assert not self._busy
+ self._busy = True
+
+ def _unmark_busy(self):
+ assert self._busy
+ self._busy = False
+
def mutter(self, text):
if 'transport' in debug.debug_flags:
mutter(text)
class Reporter:
- def __init__(self, (reporter, report_baton)):
+ def __init__(self, transport, (reporter, report_baton)):
self._reporter = reporter
self._baton = report_baton
+ self._transport = transport
@convert_svn_error
def set_path(self, path, revnum, start_empty, lock_token, pool=None):
@@ -223,11 +252,13 @@
def finish_report(self, pool=None):
svn.ra.reporter2_invoke_finish_report(self._reporter,
self._baton, pool)
+ self._transport._unmark_busy()
@convert_svn_error
def abort_report(self, pool=None):
svn.ra.reporter2_invoke_abort_report(self._reporter,
self._baton, pool)
+ self._transport._unmark_busy()
def has(self, relpath):
"""See Transport.has()."""
@@ -246,11 +277,13 @@
raise TransportNotPossible('stat not supported on Subversion')
@convert_svn_error
+ @needs_busy
def get_uuid(self):
self.mutter('svn get-uuid')
return svn.ra.get_uuid(self._ra)
@convert_svn_error
+ @needs_busy
def get_repos_root(self):
if self._root is None:
self.mutter("svn get-repos-root")
@@ -258,21 +291,29 @@
return self._root
@convert_svn_error
+ @needs_busy
def get_latest_revnum(self):
self.mutter("svn get-latest-revnum")
return svn.ra.get_latest_revnum(self._ra)
@convert_svn_error
def do_switch(self, switch_rev, recurse, switch_url, *args, **kwargs):
- assert self._backing_url == self.svn_url, "backing url invalid: %r != %r" % (self._backing_url, self.svn_url)
+ self._open_real_transport()
self.mutter('svn switch -r %d -> %r' % (switch_rev, switch_url))
- return self.Reporter(svn.ra.do_switch(self._ra, switch_rev, "", recurse, switch_url, *args, **kwargs))
+ self._mark_busy()
+ return self.Reporter(self, svn.ra.do_switch(self._ra, switch_rev, "", recurse, switch_url, *args, **kwargs))
@convert_svn_error
+ @needs_busy
def get_log(self, path, from_revnum, to_revnum, *args, **kwargs):
self.mutter('svn log %r:%r %r' % (from_revnum, to_revnum, path))
return svn.ra.get_log(self._ra, [self._request_path(path)], from_revnum, to_revnum, *args, **kwargs)
+ def _open_real_transport(self):
+ if self._backing_url != self.svn_url:
+ self.reparent(self.svn_url)
+ assert self._backing_url == self.svn_url
+
def reparent_root(self):
if self._is_http_transport():
self.svn_url = self.base = self.get_repos_root()
@@ -280,13 +321,13 @@
self.reparent(self.get_repos_root())
@convert_svn_error
+ @needs_busy
def reparent(self, url):
url = url.rstrip("/")
- if url == self.svn_url:
- return
self.base = url
self.svn_url = url
- self._backing_url = url
+ if url == self._backing_url:
+ return
if hasattr(svn.ra, 'reparent'):
self.mutter('svn reparent %r' % url)
svn.ra.reparent(self._ra, url, self.pool)
@@ -294,14 +335,16 @@
self.mutter('svn reparent (reconnect) %r' % url)
self._ra = svn.client.open_ra_session(self.svn_url.encode('utf8'),
self._client, self.pool)
+ self._backing_url = url
@convert_svn_error
+ @needs_busy
def get_dir(self, path, revnum, pool=None, kind=False):
self.mutter("svn ls -r %d '%r'" % (revnum, path))
+ assert len(path) == 0 or path[0] != "/"
path = self._request_path(path)
# ra_dav backends fail with strange errors if the path starts with a
# slash while other backends don't.
- assert len(path) == 0 or path[0] != "/"
if hasattr(svn.ra, 'get_dir2'):
fields = 0
if kind:
@@ -315,7 +358,6 @@
relpath = urlutils.join(
urlutils.relative_url(self._backing_url, self.svn_url),
relpath)
- relpath = relpath.rstrip("/")
return relpath
@convert_svn_error
@@ -333,6 +375,7 @@
return dirents.keys()
@convert_svn_error
+ @needs_busy
def get_lock(self, path):
return svn.ra.get_lock(self._ra, path)
@@ -344,14 +387,15 @@
def unlock(self):
self.transport.unlock(self.locks)
-
@convert_svn_error
+ @needs_busy
def unlock(self, locks, break_lock=False):
def lock_cb(baton, path, do_lock, lock, ra_err, pool):
pass
return svn.ra.unlock(self._ra, locks, break_lock, lock_cb)
@convert_svn_error
+ @needs_busy
def lock_write(self, path_revs, comment=None, steal_lock=False):
return self.PhonyLock() # FIXME
tokens = {}
@@ -361,13 +405,15 @@
return SvnLock(self, tokens)
@convert_svn_error
+ @needs_busy
def check_path(self, path, revnum, *args, **kwargs):
+ assert len(path) == 0 or path[0] != "/"
path = self._request_path(path)
- assert len(path) == 0 or path[0] != "/"
self.mutter("svn check_path -r%d %s" % (revnum, path))
return svn.ra.check_path(self._ra, path.encode('utf-8'), revnum, *args, **kwargs)
@convert_svn_error
+ @needs_busy
def mkdir(self, relpath, mode=None):
assert len(relpath) == 0 or relpath[0] != "/"
path = urlutils.join(self.svn_url, relpath)
@@ -382,14 +428,17 @@
@convert_svn_error
def do_update(self, revnum, *args, **kwargs):
- assert self._backing_url == self.svn_url, "backing url invalid: %r != %r" % (self._backing_url, self.svn_url)
+ self._open_real_transport()
self.mutter('svn update -r %r' % revnum)
- return self.Reporter(svn.ra.do_update(self._ra, revnum, "", *args, **kwargs))
+ self._mark_busy()
+ return self.Reporter(self, svn.ra.do_update(self._ra, revnum, "",
+ *args, **kwargs))
@convert_svn_error
def get_commit_editor(self, *args, **kwargs):
- assert self._backing_url == self.svn_url, "backing url invalid: %r != %r" % (self._backing_url, self.svn_url)
- return Editor(svn.ra.get_commit_editor(self._ra, *args, **kwargs))
+ self._open_real_transport()
+ self._mark_busy()
+ return Editor(self, svn.ra.get_commit_editor(self._ra, *args, **kwargs))
def listable(self):
"""See Transport.listable().
@@ -413,7 +462,8 @@
def clone_root(self):
if self._is_http_transport():
- return SvnRaTransport(self.get_repos_root(), self.base)
+ return SvnRaTransport(self.get_repos_root(),
+ bzr_to_svn_url(self.base))
return SvnRaTransport(self.get_repos_root())
def clone(self, offset=None):
=== modified file 'workingtree.py'
--- a/workingtree.py 2007-08-26 10:23:08 +0000
+++ b/workingtree.py 2007-09-09 00:43:15 +0000
@@ -405,7 +405,9 @@
def commit(self, message=None, message_callback=None, revprops=None,
timestamp=None, timezone=None, committer=None, rev_id=None,
allow_pointless=True, strict=False, verbose=False, local=False,
- reporter=None, config=None, specific_files=None):
+ reporter=None, config=None, specific_files=None, author=None):
+ if author is not None:
+ revprops['author'] = author
# FIXME: Use allow_pointless
# FIXME: Use verbose
# FIXME: Use reporter
More information about the Pkg-bazaar-commits
mailing list