Rev 432: Merge from 0.3 branch in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
Jelmer Vernooij
jelmer at samba.org
Mon Mar 19 15:55:37 GMT 2007
At http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev
------------------------------------------------------------
revno: 432
revision-id: jelmer at samba.org-20070313002403-57ghh1n3sqrurjtr
parent: jelmer at samba.org-20070308184856-mf3b7dh75r0d1dbg
parent: jelmer at samba.org-20070313001750-tjw1x4m48updphg6
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Tue 2007-03-13 01:24:03 +0100
message:
Merge from 0.3 branch
modified:
AUTHORS AUTHORS-20060508114718-4c90c0062645106d
NEWS news-20061231030336-h9fhq245ie0de8bs-1
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
checkout.py workingtree.py-20060306120941-b083cb0fdd4a69de
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_commit.py test_commit.py-20060624213521-l5kcufywkh9mnilk-1
tests/test_fileids.py test_fileids.py-20060622131341-19gyrlgqy8yl2od5-1
tests/test_logwalker.py test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
tests/test_workingtree.py test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
tree.py tree.py-20060624222557-dudlwqcmkf22lt2s-1
------------------------------------------------------------
revno: 402.1.26
merged: jelmer at samba.org-20070313001750-tjw1x4m48updphg6
parent: jelmer at samba.org-20070313001434-ynu3jjm33u1zbu9j
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-03-13 01:17:50 +0100
message:
All of the original svn2bzr code is gone now, remove references to it.
------------------------------------------------------------
revno: 402.1.25
merged: jelmer at samba.org-20070313001434-ynu3jjm33u1zbu9j
parent: jelmer at samba.org-20070312234911-720qkouscnlrdzhx
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-03-13 01:14:34 +0100
message:
Disable revert test (won't fix revert before 0.3.2)
------------------------------------------------------------
revno: 402.1.24
merged: jelmer at samba.org-20070312234911-720qkouscnlrdzhx
parent: jelmer at samba.org-20070312231130-3q3rr8sgwwf0ikzg
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-03-13 00:49:11 +0100
message:
Add test for pushing to nested branch locations.
------------------------------------------------------------
revno: 402.1.23
merged: jelmer at samba.org-20070312231130-3q3rr8sgwwf0ikzg
parent: jelmer at samba.org-20070312225122-7uh34ah30dqupuov
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Tue 2007-03-13 00:11:30 +0100
message:
Handle unicode characters in filenames (#54736).
------------------------------------------------------------
revno: 402.1.22
merged: jelmer at samba.org-20070312225122-7uh34ah30dqupuov
parent: jelmer at samba.org-20070312222054-r4acr5mlbresckgi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Mon 2007-03-12 23:51:22 +0100
message:
Add trivial test for PullResult().
Initial work on a fix for #54736.
------------------------------------------------------------
revno: 402.1.21
merged: jelmer at samba.org-20070312222054-r4acr5mlbresckgi
parent: jelmer at samba.org-20070312214831-334mlg82yvrl9395
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Mon 2007-03-12 23:20:54 +0100
message:
Fix {Branch,WorkingTree}.pull() to return PullResult.
------------------------------------------------------------
revno: 402.1.20
merged: jelmer at samba.org-20070312214831-334mlg82yvrl9395
parent: jelmer at samba.org-20070311232925-2nc3xpxxmoftgbyi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Mon 2007-03-12 22:48:31 +0100
message:
Add delta reporter argument to Branch.pull().
------------------------------------------------------------
revno: 402.1.19
merged: jelmer at samba.org-20070311232925-2nc3xpxxmoftgbyi
parent: jelmer at samba.org-20070311231857-oadyn73j674c3u1f
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Mon 2007-03-12 00:29:25 +0100
message:
Fix push instance of #85551 as well.
------------------------------------------------------------
revno: 402.1.18
merged: jelmer at samba.org-20070311231857-oadyn73j674c3u1f
parent: jelmer at samba.org-20070311225839-b1vmok87wjge8y7x
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Mon 2007-03-12 00:18:57 +0100
message:
handle unicode characters in commit messages. (#85551).
Was already fixed in a jelmer at samba.org-20070311011931-ybkbi14bf2lykzv0.
This commit just adds a test and a news entry.
------------------------------------------------------------
revno: 402.1.17
merged: jelmer at samba.org-20070311225839-b1vmok87wjge8y7x
parent: jelmer at samba.org-20070311015848-s4599kx059ggwd6s
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-11 23:58:39 +0100
message:
Make LogWalker.find_latest_change() check parent paths too. Fixes #84087.
------------------------------------------------------------
revno: 402.1.16
merged: jelmer at samba.org-20070311015848-s4599kx059ggwd6s
parent: jelmer at samba.org-20070311015822-bnsnpxp4i6fbk56d
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-11 02:58:48 +0100
message:
Remove tests for lightweight .bzr checkouts of Subversion branches. This doesn't work with
dirstate (and doesn't have to, anyway)
------------------------------------------------------------
revno: 402.1.15
merged: jelmer at samba.org-20070311015822-bnsnpxp4i6fbk56d
parent: jelmer at samba.org-20070311011931-ybkbi14bf2lykzv0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-11 02:58:22 +0100
message:
Allow WorkingTree.add() arguments to be strings.
------------------------------------------------------------
revno: 402.1.14
merged: jelmer at samba.org-20070311011931-ybkbi14bf2lykzv0
parent: jelmer at samba.org-20070304124653-qonoqatvu19wwn8p
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-11 02:19:31 +0100
message:
Fix the unicode revid/fileid warnings.
=== modified file 'AUTHORS'
--- a/AUTHORS 2007-03-04 01:09:12 +0000
+++ b/AUTHORS 2007-03-13 00:24:03 +0000
@@ -1,8 +1,5 @@
Jelmer Vernooij <jelmer at samba.org>
-contains (nowadays very small) parts of svn2bzr originally by:
-Gustavo Niemeyer <gustavo at niemeyer.net>
-
Thanks to David Allouche, Erik Bågfors, Aaron Bentley, Max Bowser,
Jerry Carter, Robert Collins, Wouter van Heyst, David James, Matthias Klose,
John Arbash Meinel, Stefan Metzmacher, Andrew Mitchell,
=== modified file 'NEWS'
--- a/NEWS 2007-03-04 12:50:03 +0000
+++ b/NEWS 2007-03-13 00:24:03 +0000
@@ -30,6 +30,13 @@
This should reduce the number of roundtrips significantly when
finding file id mappings.
+ * Check for parent paths moving as well in LogWalker.find_latest_change().
+ Fixes #84087.
+
+ * Handle unicode characters in commit messages. Fixes #85551.
+
+ * Handle unicode characters in filenames (#54736)
+
bzr-svn 0.3.1 2007-01-31
BUG FIXES
=== modified file 'TODO'
--- a/TODO 2007-02-01 10:37:09 +0000
+++ b/TODO 2007-03-13 00:24:03 +0000
@@ -16,3 +16,5 @@
- more efficient implementation for applying txdeltas to weaves. perhaps convert svn deltas to bzr deltas?
- free memory!
- implement BzrDirFormat.get_converter()
+- report changes to delta editor in Branch.pull()
+- add tests for objects returned by WorkingTree.pull(), Branch.pull()
=== modified file 'branch.py'
--- a/branch.py 2007-03-04 12:50:03 +0000
+++ b/branch.py 2007-03-13 00:24:03 +0000
@@ -14,7 +14,7 @@
# 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.branch import Branch, BranchFormat, BranchCheckResult, BzrBranch
+from bzrlib.branch import Branch, BranchFormat, BranchCheckResult, BzrBranch, PullResult
from bzrlib.bzrdir import BzrDir
from bzrlib.config import TreeConfig
from bzrlib.errors import (NotBranchError, NoWorkingTree, NoSuchRevision,
@@ -174,17 +174,21 @@
return None
def pull(self, source, overwrite=False, stop_revision=None):
+ result = PullResult()
+ result.source_branch = source
+ result.master_branch = None
+ result.target_branch = self
source.lock_read()
try:
- old_count = len(self.revision_history())
+ (result.old_revno, result.old_revid) = self.last_revision_info()
try:
self.update_revisions(source, stop_revision)
except DivergedBranches:
if overwrite:
raise NotImplementedError('overwrite not supported for Subversion branches')
raise
- new_count = len(self.revision_history())
- return new_count - old_count
+ (result.new_revno, result.new_revid) = self.last_revision_info()
+ return result
finally:
source.unlock()
=== modified file 'checkout.py'
--- a/checkout.py 2007-03-04 12:50:03 +0000
+++ b/checkout.py 2007-03-13 00:24:03 +0000
@@ -15,6 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from binascii import hexlify
+from bzrlib.branch import PullResult
from bzrlib.bzrdir import BzrDirFormat, BzrDir
from bzrlib.errors import (InvalidRevisionId, NotBranchError, NoSuchFile,
NoRepositoryPresent, BzrError)
@@ -220,7 +221,7 @@
def add_file_to_inv(relpath, id, revid, parent_id):
"""Add a file to the inventory."""
if os.path.islink(self.abspath(relpath)):
- file = InventoryLink(str(id), os.path.basename(relpath), str(parent_id))
+ file = InventoryLink(id, os.path.basename(relpath), parent_id)
file.revision = revid
file.symlink_target = os.readlink(self.abspath(relpath))
file.text_sha1 = None
@@ -228,7 +229,7 @@
file.executable = False
inv.add(file)
else:
- file = InventoryFile(str(id), os.path.basename(relpath), str(parent_id))
+ file = InventoryFile(id, os.path.basename(relpath), parent_id)
file.revision = revid
try:
data = fingerprint_file(open(self.abspath(relpath)))
@@ -284,17 +285,19 @@
def add_dir_to_inv(relpath, wc, parent_id):
entries = svn.wc.entries_read(wc, False)
entry = entries[""]
+ assert parent_id is None or isinstance(parent_id, str), "%r is not a string" % parent_id
(id, revid) = find_ids(entry, rootwc)
if id is None:
mutter('no id for %r' % entry.url)
return
+ assert isinstance(id, str), "%r is not a string" % id
# First handle directory itself
if relpath == "":
inv.add_path("", 'directory', ROOT_ID)
inv.revision_id = revid
else:
- inventry = InventoryDirectory(str(id), os.path.basename(relpath), str(parent_id))
+ inventry = InventoryDirectory(id, os.path.basename(relpath), parent_id)
inventry.revision = revid
inv.add(inventry)
@@ -396,12 +399,12 @@
if message_callback is not None:
def log_message_func(items, pool):
""" Simple log message provider for unit tests. """
- return str(message_callback(self))
+ return message_callback(self).encode("utf-8")
else:
assert isinstance(message, basestring)
def log_message_func(items, pool):
""" Simple log message provider for unit tests. """
- return str(message)
+ return message.encode("utf-8")
self.client_ctx.log_msg_baton2 = log_message_func
commit_info = svn.client.commit3(specific_files, True, False, self.client_ctx)
@@ -421,6 +424,10 @@
return revid
def add(self, files, ids=None):
+ if isinstance(files, str):
+ files = [files]
+ if isinstance(ids, str):
+ ids = [ids]
if ids:
ids = copy(ids)
ids.reverse()
@@ -449,7 +456,12 @@
return self.base_tree
- def pull(self, source, overwrite=False, stop_revision=None):
+ def pull(self, source, overwrite=False, stop_revision=None, delta_reporter=None):
+ result = PullResult()
+ result.source_branch = source
+ result.master_branch = None
+ result.target_branch = self.branch
+ (result.old_revno, result.old_revid) = self.branch.last_revision_info()
if stop_revision is None:
stop_revision = self.branch.last_revision()
rev = svn.core.svn_opt_revision_t()
@@ -457,7 +469,9 @@
rev.value.number = self.branch.repository.parse_revision_id(stop_revision)[1]
fetched = svn.client.update(self.basedir, rev, True, self.client_ctx)
self.base_revid = self.branch.repository.generate_revision_id(fetched, self.branch.branch_path)
- return fetched-rev.value.number
+ result.new_revid = self.branch.generate_revision_id(fetched)
+ result.new_revno = self.branch.revision_id_to_revno(result.new_revid)
+ return result
def get_file_sha1(self, file_id, path=None, stat_value=None):
if not path:
@@ -481,7 +495,7 @@
SVN_PROP_BZR_FILEIDS, "")
existing = committed + "".join(map(lambda (path, id): "%s\t%s\n" % (path, id), new_entries.items()))
if existing != "":
- svn.wc.prop_set(SVN_PROP_BZR_FILEIDS, str(existing), self.basedir, subwc)
+ svn.wc.prop_set(SVN_PROP_BZR_FILEIDS, existing.encode("utf-8"), self.basedir, subwc)
if wc is None:
svn.wc.adm_close(subwc)
=== modified file 'commit.py'
--- a/commit.py 2007-01-15 17:28:15 +0000
+++ b/commit.py 2007-03-13 00:24:03 +0000
@@ -292,7 +292,7 @@
mutter('obtaining commit editor')
self.editor, editor_baton = self.repository.transport.get_commit_editor(
- message, done, None, False)
+ message.encode("utf-8"), done, None, False)
if self.branch.last_revision() is None:
self.base_revnum = 0
=== modified file 'convert.py'
--- a/convert.py 2007-02-02 14:13:32 +0000
+++ b/convert.py 2007-03-13 00:24:03 +0000
@@ -1,9 +1,5 @@
# Copyright (C) 2005-2006 by Jelmer Vernooij
#
-# Early versions based on svn2bzr
-# Copyright (C) 2005 by Canonical Ltd
-# Written by Gustavo Niemeyer <gustavo at niemeyer.net>
-#
# 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
# the Free Software Foundation; either version 2 of the License, or
=== modified file 'fetch.py'
--- a/fetch.py 2007-03-04 12:50:03 +0000
+++ b/fetch.py 2007-03-13 00:24:03 +0000
@@ -103,6 +103,7 @@
return generate_file_id(self.revid, new_path)
def delete_entry(self, path, revnum, parent_id, pool):
+ path = path.decode("utf-8")
del self.inventory[self._get_old_id(parent_id, path)]
def close_directory(self, id):
@@ -114,6 +115,7 @@
file_weave.add_lines(self.revid, self.dir_baserev[id], [])
def add_directory(self, path, parent_id, copyfrom_path, copyfrom_revnum, pool):
+ path = path.decode("utf-8")
file_id = self._get_new_id(parent_id, path)
self.dir_baserev[file_id] = []
@@ -193,6 +195,7 @@
mutter('unsupported file property %r' % name)
def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
+ path = path.decode("utf-8")
self.is_symlink = False
self.is_executable = None
self.file_data = ""
=== modified file 'fileids.py'
--- a/fileids.py 2007-01-14 01:56:13 +0000
+++ b/fileids.py 2007-03-13 00:24:03 +0000
@@ -110,7 +110,7 @@
def load(self, revid):
map = {}
for filename,create_revid,id in self.cachedb.execute("select filename, create_revid, id from filemap where revid='%s'"%revid):
- map[filename] = (id,create_revid)
+ map[filename] = (id.encode("utf-8"),create_revid.encode("utf-8"))
return map
=== modified file 'logwalker.py'
--- a/logwalker.py 2007-03-03 20:42:14 +0000
+++ b/logwalker.py 2007-03-13 00:24:03 +0000
@@ -228,7 +228,7 @@
extra = " or path like '%s/%%'" % path.strip("/")
else:
extra = ""
- query = "select rev from changed_path where (path='%s'%s) and rev <= %d order by rev desc limit 1" % (path.strip("/"), extra, revnum)
+ query = "select rev from changed_path where (path='%s' or ('%s' like (path || '/%%') and (action = 'R' or action = 'A'))%s) and rev <= %d order by rev desc limit 1" % (path.strip("/"), path.strip("/"), extra, revnum)
row = self.db.execute(query).fetchone()
if row is None and path == "":
=== modified file 'repository.py'
--- a/repository.py 2007-01-20 23:11:09 +0000
+++ b/repository.py 2007-03-13 00:24:03 +0000
@@ -101,8 +101,8 @@
assert revnum >= 0
if revnum == 0:
return NULL_REVISION
- return unicode("%s%s:%s:%s:%d" % (REVISION_ID_PREFIX, scheme, uuid, \
- escape_svn_path(path.strip("/")), revnum))
+ return "%s%s:%s:%s:%d" % (REVISION_ID_PREFIX, scheme, uuid, \
+ escape_svn_path(path.strip("/")), revnum)
def svk_feature_to_revision_id(feature):
=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py 2007-01-09 04:25:01 +0000
+++ b/tests/test_commit.py 2007-03-12 23:49:11 +0000
@@ -14,10 +14,11 @@
# 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.branch import Branch, BranchReferenceFormat
+from bzrlib.branch import Branch, BranchReferenceFormat, PullResult
from bzrlib.bzrdir import BzrDir, BzrDirFormat
from bzrlib.errors import DivergedBranches
from bzrlib.inventory import Inventory
+from bzrlib.trace import mutter
from bzrlib.workingtree import WorkingTree
import os
@@ -58,6 +59,20 @@
self.assertEqual(wt.branch.last_revision(), new_revision.revision_id)
self.assertEqual("data", new_revision.message)
+ def test_commit_message_nordic(self):
+ repos_url = self.make_client('d', 'dc')
+ self.build_tree({'dc/foo/bla': "data"})
+ self.client_add("dc/foo")
+ wt = WorkingTree.open("dc")
+ self.assertEqual(
+ wt.branch.generate_revision_id(1), wt.commit(message=u"\xe6\xf8\xe5"))
+ self.assertEqual(
+ wt.branch.generate_revision_id(1), wt.branch.last_revision())
+ new_revision = wt.branch.repository.get_revision(
+ wt.branch.last_revision())
+ self.assertEqual(wt.branch.last_revision(), new_revision.revision_id)
+ self.assertEqual(u"\xe6\xf8\xe5", new_revision.message.decode("utf-8"))
+
def test_commit_update(self):
repos_url = self.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
@@ -82,113 +97,6 @@
self.assertEqual("some-ghost-revision\n",
self.client_get_prop(repos_url, "bzr:merge", 1))
-class TestCommitFromBazaar(TestCaseWithSubversionRepository):
- def setUp(self):
- super(TestCommitFromBazaar, self).setUp()
- self.repos_url = self.make_repository('d')
- source = BzrDir.open("svn+"+self.repos_url)
- os.mkdir('dc')
- self.checkout = BzrDirFormat.get_default_format().initialize('dc')
- BranchReferenceFormat().initialize(self.checkout, source.open_branch())
-
- def test_simple_commit(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/bla': "data"})
- wt.add('bla')
- wt.commit(message='commit from Bazaar')
- self.assertNotEqual(None, wt.branch.last_revision())
-
- def test_commit_executable(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/bla': "data"})
- wt.add('bla')
- os.chmod(os.path.join(self.test_dir, 'dc', 'bla'), 0755)
- wt.commit(message='commit from Bazaar')
-
- inv = wt.branch.repository.get_inventory(wt.branch.last_revision())
- self.assertTrue(inv[inv.path2id("bla")].executable)
-
- def test_commit_symlink(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/bla': "data"})
- wt.add('bla')
- os.symlink('bla', 'dc/foo')
- wt.add('foo')
- wt.commit(message='commit from Bazaar')
-
- inv = wt.branch.repository.get_inventory(wt.branch.last_revision())
- self.assertEqual('symlink', inv[inv.path2id("foo")].kind)
- self.assertEqual('bla', inv[inv.path2id("foo")].symlink_target)
-
- def test_commit_remove_executable(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/bla': "data"})
- wt.add('bla')
- os.chmod(os.path.join(self.test_dir, 'dc', 'bla'), 0755)
- wt.commit(message='commit from Bazaar')
-
- os.chmod(os.path.join(self.test_dir, 'dc', 'bla'), 0644)
- wt.commit(message='remove executable')
-
- inv = wt.branch.repository.get_inventory(wt.branch.last_revision())
- self.assertFalse(inv[inv.path2id("bla")].executable)
-
- def test_commit_parents(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/foo/bla': "data", 'dc/bla': "otherdata"})
- wt.add('bla')
- wt.commit(message="data")
- wt.add('foo')
- wt.add('foo/bla')
- self.assertTrue(wt.inventory.has_filename("bla"))
- self.assertTrue(wt.inventory.has_filename("foo/bla"))
- wt.set_pending_merges(["some-ghost-revision"])
- wt.commit(message="data")
- self.assertEqual([
- wt.branch.generate_revision_id(1),
- "some-ghost-revision"],
- wt.branch.repository.revision_parents(wt.branch.last_revision()))
- self.assertEqual("some-ghost-revision\n",
- self.client_get_prop(self.repos_url, "bzr:merge", 2))
-
- def test_commit_fileids(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/file': 'data'})
- wt.add('file')
- wt.commit(message="Commit from Bzr")
- self.assertEqual("file\t%s\n" % wt.inventory.path2id("file"),
- self.client_get_prop(self.repos_url, "bzr:file-ids", 1))
-
- def test_commit_fileids_added(self):
-
- rev = svn.core.svn_opt_revision_t()
- rev.kind = svn.core.svn_opt_revision_head
-
- svn.client.checkout2(self.repos_url, "db",
- rev, rev, True, False, self.client_ctx)
-
- self.build_tree({'dc/file1': 'data', 'db/file2': "otherdata"})
- self.client_add("db/file2")
- self.client_commit("db", "amesg")
- branch = Branch.open(self.repos_url)
- inv = branch.repository.get_inventory(branch.last_revision())
- wt = self.checkout.create_workingtree()
- self.assertEqual(wt.inventory.root.file_id, inv.root.file_id)
- wt.add('file1')
- wt.commit(message="Commit from Bzr")
- self.assertEqual("file1\t%s\n" % wt.inventory.path2id("file1"),
- self.client_get_prop(self.repos_url, "bzr:file-ids", 2))
-
- def test_commit_branchnick(self):
- wt = self.checkout.create_workingtree()
- self.build_tree({'dc/foo/bla': "data", 'dc/bla': "otherdata"})
- wt.add('bla')
- wt.commit(message="data")
- wt.add('foo')
- wt.add('foo/bla')
- wt.commit(message="data", revprops={"branch-nick": "mybranch"})
- self.assertEqual("mybranch",
- self.client_get_prop(self.repos_url, "bzr:revprop:branch-nick", 2))
class TestPush(TestCaseWithSubversionRepository):
def setUp(self):
@@ -204,16 +112,24 @@
self.newdir = self.olddir.sprout("dc")
def test_empty(self):
- self.assertEqual(0, self.olddir.open_branch().pull(
- self.newdir.open_branch()))
+ self.assertEqual(0, int(self.olddir.open_branch().pull(
+ self.newdir.open_branch())))
+
+ def test_empty_result(self):
+ result = self.olddir.open_branch().pull(self.newdir.open_branch())
+ self.assertIsInstance(result, PullResult)
+ self.assertEqual(result.old_revno, self.olddir.open_branch().revno())
+ self.assertEqual(result.master_branch, None)
+ self.assertEqual(result.target_branch.bzrdir.transport.base, self.olddir.transport.base)
+ self.assertEqual(result.source_branch.bzrdir.transport.base, self.newdir.transport.base)
def test_child(self):
self.build_tree({'sc/foo/bar': "data"})
self.client_add("sc/foo/bar")
self.client_commit("sc", "second message")
- self.assertEqual(0, self.olddir.open_branch().pull(
- self.newdir.open_branch()))
+ self.assertEqual(0, int(self.olddir.open_branch().pull(
+ self.newdir.open_branch())))
def test_diverged(self):
self.build_tree({'sc/foo/bar': "data"})
@@ -299,6 +215,19 @@
self.assertEqual("Commit from Bzr",
repos.get_revision(repos.generate_revision_id(2, "")).message)
+ def test_message_nordic(self):
+ self.build_tree({'dc/file': 'data'})
+ wt = self.newdir.open_workingtree()
+ wt.add('file')
+ wt.commit(message=u"\xe6\xf8\xe5")
+
+ self.olddir.open_branch().pull(self.newdir.open_branch())
+
+ repos = self.olddir.find_repository()
+ self.assertEqual(u"\xe6\xf8\xe5",
+ repos.get_revision(repos.generate_revision_id(2, "")).message.decode("utf-8"))
+
+
def test_multiple(self):
self.build_tree({'dc/file': 'data'})
wt = self.newdir.open_workingtree()
@@ -327,3 +256,26 @@
self.assertTrue(wt.branch.last_revision() in
repos.get_ancestry(repos.generate_revision_id(3, "")))
+class TestPushNested(TestCaseWithSubversionRepository):
+ def setUp(self):
+ super(TestPushNested, self).setUp()
+ self.repos_url = self.make_client('d', 'sc')
+
+ self.build_tree({'sc/foo/trunk/bla': "data"})
+ self.client_add("sc/foo")
+ self.client_commit("sc", "foo")
+
+ self.olddir = BzrDir.open("sc/foo/trunk")
+ os.mkdir("dc")
+ self.newdir = self.olddir.sprout("dc")
+
+ def test_simple(self):
+ self.build_tree({'dc/file': 'data'})
+ wt = self.newdir.open_workingtree()
+ wt.add('file')
+ wt.commit(message="Commit from Bzr")
+ self.olddir.open_branch().pull(self.newdir.open_branch())
+ repos = self.olddir.find_repository()
+ self.client_update("sc")
+ self.assertTrue(os.path.exists("sc/foo/trunk/file"))
+ self.assertFalse(os.path.exists("sc/foo/trunk/filel"))
=== modified file 'tests/test_fileids.py'
--- a/tests/test_fileids.py 2007-03-04 01:15:48 +0000
+++ b/tests/test_fileids.py 2007-03-13 00:24:03 +0000
@@ -168,6 +168,23 @@
self.assertEqual("2 at uuid:bp:mypath%2C%8A",
generate_file_id(generate_svn_revision_id("uuid", 2, "bp"), "mypath\x2c\x8a"))
+ def test_generate_file_id_special_char(self):
+ self.assertEqual(u"svn-v2:2 at uuid-bp-mypath\x2c\x8a".encode("utf-8"),
+ generate_file_id("svn-v2:2 at uuid-bp", u"mypath\x2c\x8a"))
+
+ def test_generate_svn_file_id(self):
+ self.assertEqual("svn-v2:2 at uuid-bp-path",
+ generate_svn_file_id("uuid", 2, "bp", "path"))
+
+ def test_generate_svn_file_id_nordic(self):
+ self.assertEqual("svn-v2:2 at uuid-bp-\xc3\xa6\xc3\xb8\xc3\xa5",
+ generate_svn_file_id("uuid", 2, "bp", u"\xe6\xf8\xe5"))
+
+ def test_generate_svn_file_id_nordic_branch(self):
+ self.assertEqual("svn-v2:2 at uuid-\xc3\xa6-\xc3\xa6\xc3\xb8\xc3\xa5",
+ generate_svn_file_id("uuid", 2, u"\xe6", u"\xe6\xf8\xe5"))
+
+
class TestFileMapping(TestCase):
def apply_mappings(self, mappings, find_children=None, renames={}):
map = {}
=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py 2007-01-03 07:13:12 +0000
+++ b/tests/test_logwalker.py 2007-03-11 22:58:39 +0000
@@ -122,18 +122,60 @@
self.assertEqual(0, walker.find_latest_change("", 1))
- def test_find_latest_notfound(self):
- repos_url = self.make_client("a", "dc")
- self.build_tree({'dc/branches/tmp': None})
- self.client_add("dc/branches")
- self.client_commit("dc", "My Message")
-
- self.client_copy("dc/branches", "dc/bla")
- self.client_commit("dc", "My Message")
-
- walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
-
- self.assertIs(None, walker.find_latest_change("bla/tmp", 2))
+ def test_find_latest_parent(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp/foo': None, 'dc/tags': None})
+ self.client_add("dc/branches")
+ self.client_add("dc/tags")
+ self.client_commit("dc", "My Message")
+ self.client_copy("dc/branches/tmp", "dc/tags/tmp");
+ self.client_commit("dc", "My Message2")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertEqual(2, walker.find_latest_change("tags/tmp/foo", 2))
+
+ def test_find_latest_parent_just_modify(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp/foo': None, 'dc/tags': None})
+ self.client_add("dc/branches")
+ self.client_add("dc/tags")
+ self.client_commit("dc", "My Message")
+ self.client_copy("dc/branches/tmp", "dc/tags/tmp");
+ self.client_commit("dc", "My Message2")
+ self.client_update("dc")
+ self.client_set_prop("dc/tags", "myprop", "mydata")
+ self.client_commit("dc", "My Message3")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+ self.assertEqual(2, walker.find_latest_change("tags/tmp/foo", 3))
+
+ def test_find_latest_parentmoved(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp': None})
+ self.client_add("dc/branches")
+ self.client_commit("dc", "My Message")
+
+ self.client_copy("dc/branches", "dc/bla")
+ self.client_commit("dc", "My Message")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertIs(2, walker.find_latest_change("bla/tmp", 2))
+
+ def test_find_latest_nonexistant(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp': None})
+ self.client_add("dc/branches")
+ self.client_commit("dc", "My Message")
+
+ self.client_copy("dc/branches", "dc/bla")
+ self.client_commit("dc", "My Message")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertIs(None, walker.find_latest_change("bloe", 2))
+ self.assertIs(None, walker.find_latest_change("bloe/bla", 2))
def test_find_latest_change(self):
repos_url = self.make_client("a", "dc")
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2007-03-04 01:15:48 +0000
+++ b/tests/test_repos.py 2007-03-13 00:24:03 +0000
@@ -769,6 +769,96 @@
newrepos = dir.create_repository()
oldrepos.copy_content_into(newrepos)
+ def test_fetch_replace_nordic(self):
+ filename = os.path.join(self.test_dir, "dumpfile")
+ open(filename, 'w').write("""SVN-fs-dump-format-version: 2
+
+UUID: 606c7b1f-987c-4826-b37d-eb556ceb87e1
+
+Revision-number: 0
+Prop-content-length: 56
+Content-length: 56
+
+K 8
+svn:date
+V 27
+2006-12-26T00:04:55.850520Z
+PROPS-END
+
+Revision-number: 1
+Prop-content-length: 103
+Content-length: 103
+
+K 7
+svn:log
+V 3
+add
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-26T00:05:15.504335Z
+PROPS-END
+
+Node-path: x\xc3\xa1
+Node-kind: dir
+Node-action: add
+Prop-content-length: 10
+Content-length: 10
+
+PROPS-END
+
+Node-path: u\xc3\xa1
+Node-path: bla
+Node-kind: file
+Node-action: add
+Prop-content-length: 10
+Text-content-length: 5
+Text-content-md5: 49803c8f7913948eb3e30bae749ae6bd
+Content-length: 15
+
+PROPS-END
+bloe
+
+
+Revision-number: 2
+Prop-content-length: 105
+Content-length: 105
+
+K 7
+svn:log
+V 5
+readd
+K 10
+svn:author
+V 6
+jelmer
+K 8
+svn:date
+V 27
+2006-12-26T00:05:43.584249Z
+PROPS-END
+
+Node-path: x\xc3\xa1
+Node-action: delete
+
+""")
+ os.mkdir("old")
+
+ load_dumpfile("dumpfile", "old")
+ oldrepos = Repository.open("old")
+ dir = BzrDir.create("f")
+ newrepos = dir.create_repository()
+ oldrepos.copy_content_into(newrepos)
+ self.assertTrue(newrepos.has_revision(
+ oldrepos.generate_revision_id(1, "")))
+ inv1 = newrepos.get_inventory(
+ oldrepos.generate_revision_id(1, ""))
+ self.assertTrue(inv1.has_filename(u"x\xe1"))
+
def test_fetch_replace_with_subreplace(self):
filename = os.path.join(self.test_dir, "dumpfile")
open(filename, 'w').write("""SVN-fs-dump-format-version: 2
@@ -1934,6 +2024,10 @@
self.assertEqual("svn-v%d-undefined:myuuid:branch%%2C:5" % MAPPING_VERSION,
generate_svn_revision_id("myuuid", 5, "branch\x2c"))
+ def test_generate_revid_nordic(self):
+ self.assertEqual("svn-v%d:5 at myuuid-branch\xc3\xa6" % MAPPING_VERSION,
+ generate_svn_revision_id("myuuid", 5, u"branch\xe6"))
+
def test_parse_revid_simple(self):
self.assertEqual(("uuid", "", 4),
parse_svn_revision_id(
@@ -1985,6 +2079,10 @@
def test_unescape_svn_path_percent(self):
self.assertEqual("foobar%b", unescape_svn_path("foobar%25b"))
+ def test_escape_svn_path_nordic(self):
+ self.assertEqual(u"foobar\xe6".encode("utf-8"), escape_svn_path(u"foobar\xe6"))
+
+
class SvnRepositoryFormatTests(TestCase):
def setUp(self):
self.format = SvnRepositoryFormat()
=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py 2007-01-31 12:54:40 +0000
+++ b/tests/test_workingtree.py 2007-03-13 00:24:03 +0000
@@ -57,6 +57,29 @@
self.assertTrue(inv.has_filename("bl"))
self.assertFalse(inv.has_filename("aa"))
+ def test_add_nolist(self):
+ self.make_client('a', 'dc')
+ self.build_tree({"dc/bl": "data"})
+ tree = WorkingTree.open("dc")
+ tree.add("bl")
+
+ inv = tree.read_working_inventory()
+ self.assertIsInstance(inv, Inventory)
+ self.assertTrue(inv.has_filename("bl"))
+ self.assertFalse(inv.has_filename("aa"))
+
+ def test_add_nolist_withid(self):
+ self.make_client('a', 'dc')
+ self.build_tree({"dc/bl": "data"})
+ tree = WorkingTree.open("dc")
+ tree.add("bl", "bloe")
+
+ inv = tree.read_working_inventory()
+ self.assertIsInstance(inv, Inventory)
+ self.assertTrue(inv.has_filename("bl"))
+ self.assertFalse(inv.has_filename("aa"))
+ self.assertEqual("bloe", tree.inventory.path2id("bl"))
+
def test_add_not_recursive(self):
self.make_client('a', 'dc')
self.build_tree({"dc/bl/file": "data"})
@@ -145,11 +168,12 @@
self.assertTrue(tree.is_control_filename(".svn"))
self.assertFalse(tree.is_control_filename(".bzr"))
- def test_revert(self):
+ def notest_revert(self):
self.make_client('a', 'dc')
self.build_tree({"dc/bl": "data"})
self.client_add("dc/bl")
self.client_commit("dc", "Bla")
+ self.client_update("dc")
tree = WorkingTree.open("dc")
os.remove("dc/bl")
tree.revert(["bl"])
=== modified file 'tree.py'
--- a/tree.py 2007-02-02 19:48:10 +0000
+++ b/tree.py 2007-03-13 00:24:03 +0000
@@ -89,6 +89,7 @@
return ROOT_ID
def add_directory(self, path, parent_baton, copyfrom_path, copyfrom_revnum, pool):
+ path = path.decode("utf-8")
file_id, revision_id = self.tree.id_map[path]
ie = self.tree._inventory.add_path(path, 'directory', file_id)
ie.revision = revision_id
@@ -142,6 +143,7 @@
mutter('unsupported file property %r' % name)
def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
+ path = path.decode("utf-8")
self.is_symlink = False
self.is_executable = False
return path
More information about the bazaar-commits
mailing list