Rev 444: Merge some fixes from 0.3 branch. in sftp://people.samba.org/data/bzr/jelmer/bzr-svn/bzr.dev/
Jelmer Vernooij
jelmer at samba.org
Sun Apr 15 17:16:47 BST 2007
At sftp://people.samba.org/data/bzr/jelmer/bzr-svn/bzr.dev/
------------------------------------------------------------
revno: 444
revision-id: jelmer at samba.org-20070415161553-4s5vprta60mch70r
parent: jelmer at samba.org-20070328121602-c6b3z2zc093l02h3
parent: jelmer at samba.org-20070415161300-w8q2nd1f32e4ik16
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sun 2007-04-15 18:15:53 +0200
message:
Merge some fixes from 0.3 branch.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
checkout.py workingtree.py-20060306120941-b083cb0fdd4a69de
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
format.py format.py-20060406233823-b6fa009fe35dfde7
tests/test_checkout.py test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
tests/test_commit.py test_commit.py-20060624213521-l5kcufywkh9mnilk-1
tests/test_convert.py test_convert.py-20060705203611-b1l0bapeku6foco0-1
------------------------------------------------------------
revno: 402.1.43
merged: jelmer at samba.org-20070415161300-w8q2nd1f32e4ik16
parent: jelmer at samba.org-20070408133954-7eltt6nsd6orgvnw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-04-15 18:13:00 +0200
message:
Fix compatibility with bzr.dev.
------------------------------------------------------------
revno: 402.1.42
merged: jelmer at samba.org-20070408133954-7eltt6nsd6orgvnw
parent: jelmer at samba.org-20070408012744-947rmcugvtga8ld8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-04-08 15:39:54 +0200
message:
No longer mark bug 91641 as fixed.
------------------------------------------------------------
revno: 402.1.41
merged: jelmer at samba.org-20070408012744-947rmcugvtga8ld8
parent: jelmer at samba.org-20070403203246-0tnykd16qpi4uy3n
parent: mwh at quickbeam-20070407224317-ltv1d3qhujm9pypi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-04-08 03:27:44 +0200
message:
Add test for bug #91641
------------------------------------------------------------
revno: 402.1.19.1.1
merged: mwh at quickbeam-20070407224317-ltv1d3qhujm9pypi
parent: jelmer at samba.org-20070311232925-2nc3xpxxmoftgbyi
committer: Michael Hudson <mwh at quickbeam>
branch nick: bzrsvn
timestamp: Sat 2007-04-07 23:43:17 +0100
message:
failing test
------------------------------------------------------------
revno: 402.1.40
merged: jelmer at samba.org-20070403203246-0tnykd16qpi4uy3n
parent: jelmer at samba.org-20070403125101-53li3xzbpbsxryb3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-04-03 22:32:46 +0200
message:
Set parent URLs in svn-import. (#94406)
------------------------------------------------------------
revno: 402.1.39
merged: jelmer at samba.org-20070403125101-53li3xzbpbsxryb3
parent: jelmer at samba.org-20070325151508-eliztm1ms969fjk8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-04-03 14:51:01 +0200
message:
Initial work on supporting "upgrades" of .svn directories to .bzr directories.
=== modified file 'NEWS'
--- a/NEWS 2007-03-15 16:30:13 +0000
+++ b/NEWS 2007-04-15 16:15:53 +0000
@@ -30,6 +30,8 @@
* Don't do extra checkout before push if possible. (#91885)
+ * Set parent URLs in svn-import. (#94406)
+
bzr-svn 0.3.2 2007-03-13
BUG FIXES
=== modified file 'TODO'
--- a/TODO 2007-03-25 18:41:40 +0000
+++ b/TODO 2007-04-15 16:15:53 +0000
@@ -1,3 +1,4 @@
+- rename 'main' to 0.4
- simplify find_branches by using Transport.list_dir() ?
- replace 'undefined' by scheme name in revision ids
- fix commits in heavyweight checkouts somehow
@@ -19,3 +20,4 @@
- add tests for objects returned by WorkingTree.pull(), Branch.pull()
- blackbox tests
- test Branch.get_parent()
+- split fetch tests out of test_repos
=== modified file 'checkout.py'
--- a/checkout.py 2007-03-25 19:50:45 +0000
+++ b/checkout.py 2007-04-15 16:15:53 +0000
@@ -29,6 +29,7 @@
from bzrlib.workingtree import WorkingTree, WorkingTreeFormat
from branch import SvnBranch
+from convert import SvnConverter
from repository import (SvnRepository, escape_svn_path, SVN_PROP_BZR_MERGE,
SVN_PROP_SVK_MERGE, SVN_PROP_BZR_FILEIDS,
revision_id_to_svk_feature)
@@ -631,19 +632,19 @@
if not self.scheme.is_branch(self.branch_path) and not self.scheme.is_tag(self.branch_path):
raise NotBranchError(path=self.transport.base)
- def clone(self, path, revision_id=None, basis=None, force_new_repo=False):
+ def clone(self, path, revision_id=None, force_new_repo=False):
raise NotImplementedError(self.clone)
def open_workingtree(self, _unsupported=False):
return SvnWorkingTree(self, self.local_path, self.open_branch())
- def sprout(self, url, revision_id=None, basis=None, force_new_repo=False,
+ def sprout(self, url, revision_id=None, force_new_repo=False,
recurse='down'):
# FIXME: honor force_new_repo
# FIXME: Use recurse
result = BzrDirFormat.get_default_format().initialize(url)
repo = self.find_repository()
- repo.clone(result, revision_id, basis)
+ repo.clone(result, revision_id)
branch = self.open_branch()
branch.sprout(result, revision_id)
result.create_workingtree()
@@ -710,3 +711,9 @@
def initialize_on_transport(self, transport):
raise NotImplementedError(self.initialize_on_transport)
+
+ def get_converter(self, format=None):
+ """See BzrDirFormat.get_converter()."""
+ if format is None:
+ format = BzrDirFormat.get_default_format()
+ return SvnConverter(format)
=== modified file 'convert.py'
--- a/convert.py 2007-03-28 04:49:59 +0000
+++ b/convert.py 2007-04-15 16:15:53 +0000
@@ -20,7 +20,7 @@
from bzrlib.plugin import load_plugins
load_plugins()
-from bzrlib.bzrdir import BzrDir, BzrDirFormat
+from bzrlib.bzrdir import BzrDir, BzrDirFormat, Converter
from bzrlib.branch import Branch
from bzrlib.errors import (BzrError, NotBranchError,
NoSuchFile, NoRepositoryPresent)
@@ -70,7 +70,6 @@
working_trees=False, all=False):
assert not all or create_shared_repo
-
if os.path.isfile(url):
tmp_repos = tempfile.mkdtemp(prefix='bzr-svn-dump-')
mutter('loading dumpfile %r to %r' % (url, tmp_repos))
@@ -130,12 +129,14 @@
target_dir.open_repository()
except NoRepositoryPresent:
target_dir.create_repository()
+ source_branch_url = urlutils.join(url, branch)
try:
target_branch = target_dir.open_branch()
except NotBranchError:
target_branch = target_dir.create_branch()
+ target_branch.set_parent(source_branch_url)
if not revid in target_branch.revision_history():
- source_branch = Branch.open(urlutils.join(url, branch))
+ source_branch = Branch.open(source_branch_url)
# Check if target_branch contains a subset of
# source_branch. If that is not the case,
# assume that source_branch has been replaced
@@ -143,7 +144,6 @@
if not target_branch.last_revision() in \
source_branch.revision_history():
target_branch.set_revision_history([])
-
target_branch.pull(source_branch)
if working_trees and not target_dir.has_workingtree():
target_dir.create_workingtree()
@@ -153,3 +153,12 @@
finally:
if tmp_repos:
osutils.rmtree(tmp_repos)
+
+
+class SvnConverter(Converter):
+ """Converts from a Subversion dir to another dir."""
+ def __init__(self, target_format):
+ self.target_format = target_format
+
+ def convert(self, to_convert, pb):
+ pass
=== modified file 'format.py'
--- a/format.py 2007-03-25 18:41:40 +0000
+++ b/format.py 2007-04-15 16:15:53 +0000
@@ -55,27 +55,27 @@
self.branch_path != ""):
raise NotBranchError(path=self.root_transport.base)
- def clone(self, url, revision_id=None, basis=None, force_new_repo=False):
+ def clone(self, url, revision_id=None, force_new_repo=False):
"""See BzrDir.clone().
Not supported on Subversion connections.
"""
raise NotImplementedError(SvnRemoteAccess.clone)
- def sprout(self, url, revision_id=None, basis=None, force_new_repo=False,
+ def sprout(self, url, revision_id=None, force_new_repo=False,
recurse='down'):
"""See BzrDir.sprout()."""
# FIXME: Use recurse
result = BzrDirFormat.get_default_format().initialize(url)
repo = self.find_repository()
if force_new_repo:
- result_repo = repo.clone(result, revision_id, basis)
+ result_repo = repo.clone(result, revision_id)
else:
try:
result_repo = result.find_repository()
result_repo.fetch(repo, revision_id=revision_id)
except NoRepositoryPresent:
- result_repo = repo.clone(result, revision_id, basis)
+ result_repo = repo.clone(result, revision_id)
branch = self.open_branch()
result_branch = branch.sprout(result, revision_id)
@@ -183,3 +183,4 @@
def is_supported(self):
"""See BzrDir.is_supported()."""
return True
+
=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py 2007-03-28 04:00:14 +0000
+++ b/tests/test_checkout.py 2007-04-15 16:15:53 +0000
@@ -18,7 +18,8 @@
from bzrlib.errors import NoRepositoryPresent
from bzrlib.tests import TestCase
-from checkout import SvnWorkingTreeFormat
+from convert import SvnConverter
+from checkout import SvnWorkingTreeFormat, SvnWorkingTreeDirFormat
from tests import TestCaseWithSubversionRepository
class TestWorkingTreeFormat(TestCase):
@@ -36,6 +37,14 @@
def test_open(self):
self.assertRaises(NotImplementedError, self.format.open, None)
+class TestCheckoutFormat(TestCase):
+ def setUp(self):
+ super(TestCheckoutFormat, self).setUp()
+ self.format = SvnWorkingTreeDirFormat()
+
+ def test_get_converter(self):
+ self.assertIsInstance(self.format.get_converter(), SvnConverter)
+
class TestCheckout(TestCaseWithSubversionRepository):
def test_not_for_writing(self):
=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py 2007-03-28 04:00:14 +0000
+++ b/tests/test_commit.py 2007-04-15 16:15:53 +0000
@@ -91,6 +91,42 @@
self.assertEqual("some-ghost-revision\n",
self.client_get_prop(repos_url, "bzr:merge", 1))
+ def test_mwh(self):
+ repo = self.make_client('d', 'sc')
+ def mv(*mvs):
+ for a, b in mvs:
+ self.client_copy(a, b)
+ self.client_delete(a)
+ self.client_commit('sc', '.')
+ self.client_update('sc')
+ self.build_tree({'sc/de/foo':'data', 'sc/de/bar':'DATA'})
+ self.client_add('sc/de')
+ self.client_commit('sc', 'blah')
+ self.client_update('sc')
+ os.mkdir('sc/de/trunk')
+ self.client_add('sc/de/trunk')
+ mv(('sc/de/foo', 'sc/de/trunk'), ('sc/de/bar', 'sc/de/trunk'))
+ mv(('sc/de', 'sc/pyd'))
+ self.client_delete('sc/pyd/trunk/foo')
+ self.client_commit('sc', '.')
+ self.client_update('sc')
+
+ self.make_checkout(repo + '/pyd/trunk', 'pyd')
+ assert open('pyd/bar').read() == 'DATA'
+
+ olddir = BzrDir.open("pyd")
+ os.mkdir('bc')
+ newdir = olddir.sprout("bc")
+ newdir.open_branch().pull(olddir.open_branch())
+ wt = newdir.open_workingtree()
+ assert open('bc/bar').read() == 'DATA'
+ open('bc/bar', 'w').write('data')
+ wt.commit(message="Commit from Bzr")
+ olddir.open_branch().pull(newdir.open_branch())
+
+ self.client_update('pyd')
+ assert open('pyd/bar').read() == 'data'
+
class TestPush(TestCaseWithSubversionRepository):
def setUp(self):
=== modified file 'tests/test_convert.py'
--- a/tests/test_convert.py 2007-03-25 18:41:40 +0000
+++ b/tests/test_convert.py 2007-04-15 16:15:53 +0000
@@ -70,6 +70,14 @@
self.build_tree({'dc/trunk/file': 'otherdata'})
self.client_commit("dc", "change")
+ def test_sets_parent_urls(self):
+ convert_repository(self.repos_url, "e", TrunkBranchingScheme(),
+ all=False, create_shared_repo=True)
+ self.assertEquals(self.repos_url+"/trunk",
+ Branch.open("e/trunk").get_parent())
+ self.assertEquals(self.repos_url+"/branches/abranch",
+ Branch.open("e/branches/abranch").get_parent())
+
def test_fetch_alive(self):
self.build_tree({'dc/branches/somebranch/somefile': 'data'})
self.client_add("dc/branches/somebranch")
More information about the bazaar-commits
mailing list