Rev 423: remove directories if they are unrelated when importing (#81908) in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Fri Feb 2 14:14:07 GMT 2007
At http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
------------------------------------------------------------
revno: 423
revision-id: jelmer at samba.org-20070202141332-yt8jneutdi68j697
parent: jelmer at samba.org-20070202113947-vbxhka9gzhvff6lg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Fri 2007-02-02 15:13:32 +0100
message:
remove directories if they are unrelated when importing (#81908)
modified:
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
tests/test_convert.py test_convert.py-20060705203611-b1l0bapeku6foco0-1
=== modified file 'convert.py'
--- a/convert.py 2007-02-02 11:39:47 +0000
+++ b/convert.py 2007-02-02 14:13:32 +0000
@@ -49,6 +49,8 @@
transport.mkdir(relpath)
needed.pop()
except NoSuchFile:
+ if relpath == "":
+ raise
needed.append((transport, urlutils.dirname(relpath)))
@@ -87,7 +89,6 @@
dirs = {}
to_transport = get_transport(output_url)
- to_transport.stat('.')
def get_dir(path):
if dirs.has_key(path):
return dirs[path]
@@ -143,6 +144,14 @@
target_branch = target_dir.create_branch()
if not revid in target_branch.revision_history():
source_branch = Branch.open(urlutils.join(url, branch))
+ # Check if target_branch contains a subset of
+ # source_branch. If that is not the case,
+ # assume that source_branch has been replaced
+ # and remove target_branch
+ 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()
=== modified file 'tests/test_convert.py'
--- a/tests/test_convert.py 2007-02-02 11:39:47 +0000
+++ b/tests/test_convert.py 2007-02-02 14:13:32 +0000
@@ -112,6 +112,16 @@
self.assertTrue(Repository.open("e").is_shared())
+ def test_shared_import_continue_remove(self):
+ convert_repository(self.repos_url, "e", TrunkBranchingScheme(), True)
+ self.client_update("dc")
+ self.client_delete("dc/trunk")
+ self.client_commit("dc", "blafoo")
+ self.build_tree({'dc/trunk/file': 'otherdata'})
+ self.client_add("dc/trunk")
+ self.client_commit("dc", "change")
+ convert_repository(self.repos_url, "e", TrunkBranchingScheme(), True)
+
def test_shared_import_continue_with_wt(self):
convert_repository("svn+"+self.repos_url, "e",
TrunkBranchingScheme(), working_trees=True)
More information about the bazaar-commits
mailing list