Rev 442: Merge some formatting fixes, add extra tests. in sftp://people.samba.org/data/bzr/jelmer/bzr-svn/bzr.dev/
Jelmer Vernooij
jelmer at samba.org
Sun Mar 25 19:43:36 BST 2007
At sftp://people.samba.org/data/bzr/jelmer/bzr-svn/bzr.dev/
------------------------------------------------------------
revno: 442
revision-id: jelmer at samba.org-20070325184140-tjuwjts3rly7uypl
parent: jelmer at samba.org-20070325142008-s4xgn0ksym677933
parent: jelmer at samba.org-20070325151508-eliztm1ms969fjk8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Sun 2007-03-25 20:41:40 +0200
message:
Merge some formatting fixes, add extra tests.
added:
tests/test_blackbox.py test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
modified:
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
convert.py svn2bzr.py-20051018015439-cb4563bff29e632d
fetch.py fetch.py-20060625004942-x2lfaib8ra707a8p-1
fileids.py fileids.py-20060714013623-u5iiyqqnko11grcf-1
format.py format.py-20060406233823-b6fa009fe35dfde7
repository.py repository.py-20060306123302-1f8c5069b3fe0265
scheme.py scheme.py-20060516195850-95181aae6b272f9e
tests/__init__.py __init__.py-20060508151940-e9f4d914801a2535
tests/test_branch.py test_branch.py-20060508162215-74ffeb5d608f8e20
tests/test_branchprops.py test_branchprops.py-20061223210444-04xf5224zcg69m3w-1
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
tests/test_fileids.py test_fileids.py-20060622131341-19gyrlgqy8yl2od5-1
tests/test_logwalker.py test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
tests/test_radir.py test_radir.py-20061231173434-31utf9o4byu7wktm-1
tests/test_repos.py test_repos.py-20060508151940-ddc49a59257ca712
tests/test_transport.py test_transport.py-20060621232111-xh7xvoblzsrgj79t-1
tests/test_tree.py test_tree.py-20070103204350-pr8nupes7e5sd2wr-1
tests/test_upgrade.py test_upgrade.py-20070106170128-64zt3eqggg4tng1c-1
tests/test_workingtree.py test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
transport.py transport.py-20060406231150-b3472d06b3a0818d
tree.py tree.py-20060624222557-dudlwqcmkf22lt2s-1
upgrade.py upgrade.py-20070106192108-0rakplee2lzah4gs-1
------------------------------------------------------------
revno: 402.1.38
merged: jelmer at samba.org-20070325151508-eliztm1ms969fjk8
parent: jelmer at samba.org-20070325144144-axorlmksch0g02ps
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-25 17:15:08 +0200
message:
Add two very trivial blackbox tests.
------------------------------------------------------------
revno: 402.1.37
merged: jelmer at samba.org-20070325144144-axorlmksch0g02ps
parent: jelmer at samba.org-20070324154013-9slv88wjxilfigto
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-25 16:41:44 +0200
message:
More formatting fixes.
=== added file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py 1970-01-01 00:00:00 +0000
+++ b/tests/test_blackbox.py 2007-03-25 15:15:08 +0000
@@ -0,0 +1,27 @@
+# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer at samba.org>
+
+# 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
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# 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.tests.blackbox import ExternalBase
+from tests import TestCaseWithSubversionRepository
+
+class TestBranch(ExternalBase,TestCaseWithSubversionRepository):
+ def test_branch_empty(self):
+ repos_url = self.make_client('d', 'de')
+ self.runbzr(['branch', repos_url, 'dc'])
+
+ def test_log_empty(self):
+ repos_url = self.make_client('d', 'de')
+ self.assertEquals('', self.runbzr(['log', repos_url])[1])
=== modified file 'TODO'
--- a/TODO 2007-03-25 14:20:08 +0000
+++ b/TODO 2007-03-25 18:41:40 +0000
@@ -18,3 +18,4 @@
- report changes to delta editor in Branch.pull()
- add tests for objects returned by WorkingTree.pull(), Branch.pull()
- blackbox tests
+- test Branch.get_parent()
=== modified file '__init__.py'
--- a/__init__.py 2007-03-25 14:20:08 +0000
+++ b/__init__.py 2007-03-25 18:41:40 +0000
@@ -53,9 +53,8 @@
"""Check that Subversion is compatible.
"""
- try:
- from svn.delta import svn_delta_invoke_txdelta_window_handler
- except:
+ import svn.delta
+ if not hasattr(svn.delta, 'svn_delta_invoke_txdelta_window_handler'):
warning('Installed Subversion version does not have updated Python '
'bindings. See the bzr-svn README for details.')
raise bzrlib.errors.BzrError("incompatible python subversion bindings")
=== modified file 'branch.py'
--- a/branch.py 2007-03-25 14:20:08 +0000
+++ b/branch.py 2007-03-25 18:41:40 +0000
@@ -87,7 +87,7 @@
rev.kind = svn.core.svn_opt_revision_head
else:
assert revision_id in self.revision_history()
- (bp, revnum) = self.repository.parse_revision_id(revision_id)
+ (_, revnum) = self.repository.parse_revision_id(revision_id)
rev.kind = svn.core.svn_opt_revision_number
rev.value.number = revnum
mutter('hist: %r' % self.revision_history())
@@ -226,7 +226,7 @@
pass
def get_parent(self):
- return self.bzrdir.root_transport.base
+ return self.base
def set_parent(self, url):
pass # FIXME: Use svn.client.switch()
=== modified file 'convert.py'
--- a/convert.py 2007-03-25 14:20:08 +0000
+++ b/convert.py 2007-03-25 18:41:40 +0000
@@ -118,7 +118,7 @@
try:
i = 0
- for (branch, revnum, exists) in existing_branches:
+ for (branch, revnum, _) in existing_branches:
if source_repos.transport.check_path(branch, revnum) == svn.core.svn_node_file:
continue
pb.update("%s:%d" % (branch, revnum), i, len(existing_branches))
=== modified file 'fetch.py'
--- a/fetch.py 2007-03-25 14:20:08 +0000
+++ b/fetch.py 2007-03-25 18:41:40 +0000
@@ -352,6 +352,7 @@
def copy_content(self, revision_id=None, basis=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
=== modified file 'fileids.py'
--- a/fileids.py 2007-03-25 14:20:08 +0000
+++ b/fileids.py 2007-03-25 18:41:40 +0000
@@ -23,7 +23,6 @@
import os
import sha
-import logwalker
from repository import (escape_svn_path, generate_svn_revision_id,
parse_svn_revision_id)
@@ -103,7 +102,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.encode("utf-8"),create_revid.encode("utf-8"))
+ map[filename] = (id.encode("utf-8"), create_revid.encode("utf-8"))
return map
=== modified file 'format.py'
--- a/format.py 2007-03-25 14:20:08 +0000
+++ b/format.py 2007-03-25 18:41:40 +0000
@@ -177,7 +177,7 @@
"non-local transports")
local_path = transport._local_base.rstrip("/")
- repos = svn.repos.create(local_path, '', '', None, None)
+ svn.repos.create(local_path, '', '', None, None)
return self.open(SvnRaTransport(transport.base), _found=True)
def is_supported(self):
=== modified file 'repository.py'
--- a/repository.py 2007-03-25 14:20:08 +0000
+++ b/repository.py 2007-03-25 18:41:40 +0000
@@ -17,10 +17,8 @@
import bzrlib
from bzrlib.branch import BranchCheckResult
from bzrlib.config import config_dir, ensure_config_dir_exists
-from bzrlib.errors import (BzrError, InvalidRevisionId, NoSuchFile,
- NoSuchRevision, NotBranchError,
- UninitializableFormat)
-from bzrlib.graph import Graph
+from bzrlib.errors import (InvalidRevisionId, NoSuchRevision,
+ NotBranchError, UninitializableFormat)
from bzrlib.inventory import Inventory
from bzrlib.lockable_files import LockableFiles, TransportLock
import bzrlib.osutils as osutils
@@ -34,13 +32,11 @@
import svn.core
import os
-from cStringIO import StringIO
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3
-import branch
from branchprops import BranchPropertyList
import errors
import logwalker
@@ -386,7 +382,7 @@
if date is not None:
rev.timestamp = 1.0 * svn.core.secs_from_timestr(date, None)
else:
- rev.timestamp = 0 # FIXME: Obtain repository creation time
+ rev.timestamp = 0.0 # FIXME: Obtain repository creation time
rev.timezone = None
rev.properties = bzr_props
rev.inventory_sha1 = property(lambda: self.get_inventory_sha1(revision_id))
@@ -410,12 +406,7 @@
raise NotImplementedError(self.fileids_altered_by_revision_ids)
def fileid_involved_by_set(self, changes):
- ids = []
-
- for revid in changes:
- pass #FIXME
-
- return ids
+ raise NotImplementedError(self.fileid_involved_by_set)
def generate_revision_id(self, revnum, path):
"""Generate a unambiguous revision id.
@@ -469,7 +460,7 @@
yielded_paths.append(bp)
except NotBranchError:
pass
- revnum-=1
+ revnum -= 1
def follow_branch(self, branch_path, revnum):
assert branch_path is not None
@@ -482,7 +473,7 @@
while revnum >= 0:
paths = self._log.get_revision_paths(revnum, branch_path)
if paths == {}:
- revnum-=1
+ revnum -= 1
continue
yield (branch_path, revnum)
# FIXME: what if one of the parents of branch_path was moved?
@@ -499,7 +490,7 @@
revnum = paths[branch_path][2]
branch_path = paths[branch_path][1]
continue
- revnum-=1
+ revnum -= 1
def follow_branch_history(self, branch_path, revnum):
assert branch_path is not None
@@ -553,15 +544,16 @@
(path, revnum) = self.parse_revision_id(revision_id)
- self._previous = revision_id
+ _previous = revision_id
self._ancestry = {}
- for (branch, rev) in self.follow_branch(path, revnum - 1):
- revid = self.generate_revision_id(rev, branch)
- self._ancestry[self._previous] = [revid]
- self._previous = revid
+ if revnum > 0:
+ for (branch, rev) in self.follow_branch(path, revnum - 1):
+ revid = self.generate_revision_id(rev, branch)
+ self._ancestry[_previous] = [revid]
+ _previous = revid
- self._ancestry[self._previous] = []
+ self._ancestry[_previous] = []
return self._ancestry
=== modified file 'scheme.py'
--- a/scheme.py 2007-02-01 14:09:04 +0000
+++ b/scheme.py 2007-03-25 18:41:40 +0000
@@ -44,7 +44,7 @@
:return: New BranchingScheme instance.
"""
parts = relpath.strip("/").split("/")
- for i in range(0,len(parts)):
+ for i in range(0, len(parts)):
if parts[i] in ("trunk", "branches", "tags"):
return TrunkBranchingScheme(level=i)
=== modified file 'tests/__init__.py'
--- a/tests/__init__.py 2007-03-15 16:40:04 +0000
+++ b/tests/__init__.py 2007-03-25 18:41:40 +0000
@@ -14,7 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import svn.repos
import os
import bzrlib
from bzrlib import osutils
@@ -47,7 +46,7 @@
abspath = os.path.join(self.test_dir, relpath)
repos_url = "file://%s" % abspath
- repos = svn.repos.create(abspath, '', '', None, None)
+ svn.repos.create(abspath, '', '', None, None)
revprop_hook = os.path.join(abspath, "hooks", "pre-revprop-change")
@@ -209,7 +208,7 @@
def test_suite():
- from unittest import TestSuite, TestLoader
+ from unittest import TestSuite
from bzrlib.tests import TestUtil
@@ -218,6 +217,7 @@
suite = TestSuite()
testmod_names = [
+ 'test_blackbox',
'test_branch',
'test_branchprops',
'test_checkout',
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py 2007-03-16 00:25:16 +0000
+++ b/tests/test_branch.py 2007-03-25 18:41:40 +0000
@@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from bzrlib.branch import Branch
-from bzrlib.bzrdir import BzrDir, BzrDirTestProviderAdapter, BzrDirFormat
+from bzrlib.bzrdir import BzrDir
from bzrlib.errors import NoSuchFile
from bzrlib.repository import Repository
from bzrlib.trace import mutter
@@ -23,12 +23,9 @@
import os
from unittest import TestCase
-import svn.core, svn.client
-
from branch import FakeControlFiles, SvnBranchFormat
from convert import load_dumpfile
from fileids import generate_svn_file_id
-import format
from repository import MAPPING_VERSION, generate_svn_revision_id
from tests import TestCaseWithSubversionRepository
@@ -477,13 +474,13 @@
weave.versions())
def test_check(self):
- repos_url = self.make_client('d', 'dc')
+ self.make_client('d', 'dc')
branch = Branch.open('d')
result = branch.check()
self.assertEqual(branch, result.branch)
def test_generate_revision_id(self):
- repos_url = self.make_client('d', 'dc')
+ self.make_client('d', 'dc')
branch = Branch.open('d')
self.assertEqual("svn-v%d-undefined:%s::1" % (MAPPING_VERSION, branch.repository.uuid), branch.generate_revision_id(1))
@@ -542,7 +539,7 @@
self.assertFalse(os.path.exists("e/.bzr"))
def test_fetch_branch(self):
- repos_url = self.make_client('d', 'sc')
+ self.make_client('d', 'sc')
self.build_tree({'sc/foo/bla': "data"})
self.client_add("sc/foo")
@@ -605,7 +602,7 @@
def test_ghost_workingtree(self):
# Looks like bazaar has trouble creating a working tree of a
# revision that has ghost parents
- repos_url = self.make_client('d', 'sc')
+ self.make_client('d', 'sc')
self.build_tree({'sc/foo/bla': "data"})
self.client_add("sc/foo")
=== modified file 'tests/test_branchprops.py'
--- a/tests/test_branchprops.py 2007-03-13 09:40:12 +0000
+++ b/tests/test_branchprops.py 2007-03-25 14:41:44 +0000
@@ -19,7 +19,6 @@
from tests import TestCaseWithSubversionRepository
from branchprops import BranchPropertyList
from logwalker import LogWalker
-from scheme import NoBranchingScheme
from transport import SvnRaTransport
try:
=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py 2007-03-13 09:40:12 +0000
+++ b/tests/test_checkout.py 2007-03-25 14:41:44 +0000
@@ -19,8 +19,6 @@
from bzrlib.tests import TestCase
from checkout import SvnWorkingTreeFormat
-from format import SvnRemoteAccess
-from repository import SvnRepository
from tests import TestCaseWithSubversionRepository
class TestWorkingTreeFormat(TestCase):
@@ -41,17 +39,17 @@
class TestCheckout(TestCaseWithSubversionRepository):
def test_not_for_writing(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
x = BzrDir.create_branch_convenience("dc/foo")
self.assertFalse(hasattr(x.repository, "uuid"))
def test_open_repository(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
x = BzrDir.open("dc")
self.assertRaises(NoRepositoryPresent, x.open_repository)
def test_find_repository(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
x = BzrDir.open("dc")
self.assertTrue(hasattr(x.find_repository(), "uuid"))
=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py 2007-03-16 00:25:16 +0000
+++ b/tests/test_commit.py 2007-03-25 18:41:40 +0000
@@ -14,23 +14,17 @@
# 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, PullResult
-from bzrlib.bzrdir import BzrDir, BzrDirFormat
+from bzrlib.branch import PullResult
+from bzrlib.bzrdir import BzrDir
from bzrlib.errors import DivergedBranches
-from bzrlib.inventory import Inventory
-from bzrlib.trace import mutter
from bzrlib.workingtree import WorkingTree
import os
-import format
-import checkout
-import svn.core
-from repository import MAPPING_VERSION
from tests import TestCaseWithSubversionRepository
class TestNativeCommit(TestCaseWithSubversionRepository):
def test_simple_commit(self):
- repos_url = self.make_client('d', 'dc')
+ self.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
self.client_add("dc/foo")
wt = WorkingTree.open("dc")
@@ -46,7 +40,7 @@
self.assertTrue(new_inventory.has_filename("foo/bla"))
def test_commit_message(self):
- repos_url = self.make_client('d', 'dc')
+ self.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
self.client_add("dc/foo")
wt = WorkingTree.open("dc")
@@ -60,7 +54,7 @@
self.assertEqual("data", new_revision.message)
def test_commit_message_nordic(self):
- repos_url = self.make_client('d', 'dc')
+ self.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
self.client_add("dc/foo")
wt = WorkingTree.open("dc")
@@ -74,7 +68,7 @@
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.make_client('d', 'dc')
self.build_tree({'dc/foo/bla': "data"})
self.client_add("dc/foo")
wt = WorkingTree.open("dc")
=== modified file 'tests/test_convert.py'
--- a/tests/test_convert.py 2007-03-16 22:25:24 +0000
+++ b/tests/test_convert.py 2007-03-25 18:41:40 +0000
@@ -18,7 +18,7 @@
from bzrlib.bzrdir import BzrDir
from bzrlib.errors import NotBranchError, NoSuchFile
from bzrlib.repository import Repository
-from bzrlib.tests import TestCase, TestCaseInTempDir
+from bzrlib.tests import TestCaseInTempDir
from bzrlib.trace import mutter
import os
=== modified file 'tests/test_fileids.py'
--- a/tests/test_fileids.py 2007-03-16 00:25:16 +0000
+++ b/tests/test_fileids.py 2007-03-25 18:41:40 +0000
@@ -15,15 +15,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from bzrlib.bzrdir import BzrDir
-from bzrlib.errors import NoSuchRevision
-from bzrlib.inventory import Inventory
from bzrlib.repository import Repository
from bzrlib.trace import mutter
-from bzrlib.tests import TestSkipped, TestCase
+from bzrlib.tests import TestCase
import sha
-import format
from fileids import SimpleFileIdMap, generate_file_id, generate_svn_file_id
from repository import generate_svn_revision_id
from scheme import TrunkBranchingScheme
@@ -148,8 +145,8 @@
self.assertEqual(fileid, inv1.path2id("dir/file"))
self.assertEqual(repository.generate_revision_id(1, "trunk"), revid)
-def sha1(str):
- return sha.new(str).hexdigest()
+def sha1(text):
+ return sha.new(text).hexdigest()
class TestFileIdGenerator(TestCase):
def test_generate_file_id_root(self):
@@ -191,12 +188,12 @@
revids = mappings.keys()
revids.sort()
for r in revids:
- def new_file_id(x):
- if renames.has_key(r) and renames[r].has_key(x):
- return renames[r][x]
- return generate_file_id(r, x)
- revmap = SimpleFileIdMap._apply_changes(new_file_id, mappings[r], find_children)
- map.update(dict([(x,(revmap[x],r)) for x in revmap]))
+ def new_file_id(x):
+ if renames.has_key(r) and renames[r].has_key(x):
+ return renames[r][x]
+ return generate_file_id(r, x)
+ revmap = SimpleFileIdMap._apply_changes(new_file_id, mappings[r], find_children)
+ map.update(dict([(x, (revmap[x],r)) for x in revmap]))
return map
def test_simple(self):
=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py 2007-03-16 22:25:24 +0000
+++ b/tests/test_logwalker.py 2007-03-25 18:41:40 +0000
@@ -14,13 +14,10 @@
# 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.bzrdir import BzrDir
from bzrlib.errors import NoSuchRevision
-from bzrlib.inventory import Inventory
import os
import logwalker
-from scheme import NoBranchingScheme, TrunkBranchingScheme
from tests import TestCaseWithSubversionRepository
from transport import SvnRaTransport
@@ -128,7 +125,7 @@
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_copy("dc/branches/tmp", "dc/tags/tmp")
self.client_commit("dc", "My Message2")
walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
@@ -141,7 +138,7 @@
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_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")
@@ -273,9 +270,9 @@
self.client_commit("dc", "My Message")
for (branch, paths, rev) in walker.follow_path("", 1):
- self.assertEqual(branch, "")
- self.assertTrue(rev == 0 or paths.has_key("foo"))
- self.assertTrue(rev in (0,1))
+ self.assertEqual(branch, "")
+ self.assertTrue(rev == 0 or paths.has_key("foo"))
+ self.assertTrue(rev in (0,1))
def test_follow_history_nohist(self):
repos_url = self.make_client("a", "dc")
@@ -293,9 +290,9 @@
self.client_commit("dc", "My Message")
for (branch, paths, rev) in walker.follow_path("", 1):
- self.assertEqual(branch, "")
- self.assertTrue(rev == 0 or paths.has_key("foo"))
- self.assertTrue(rev in (0,1))
+ self.assertEqual(branch, "")
+ self.assertTrue(rev == 0 or paths.has_key("foo"))
+ self.assertTrue(rev in (0,1))
iter = walker.follow_path("", 2)
self.assertRaises(NoSuchRevision, list, iter)
=== modified file 'tests/test_radir.py'
--- a/tests/test_radir.py 2007-03-13 09:40:12 +0000
+++ b/tests/test_radir.py 2007-03-25 14:41:44 +0000
@@ -16,11 +16,7 @@
from bzrlib.bzrdir import BzrDir
from bzrlib.errors import NoRepositoryPresent, NotBranchError, NotLocalUrl
-from bzrlib.tests import TestCase
-from bzrlib.transport import get_transport
-from format import SvnRemoteAccess
-from repository import SvnRepository
from tests import TestCaseWithSubversionRepository
class TestRemoteAccess(TestCaseWithSubversionRepository):
=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py 2007-03-16 12:09:02 +0000
+++ b/tests/test_repos.py 2007-03-25 18:41:40 +0000
@@ -16,27 +16,22 @@
from bzrlib.branch import Branch
from bzrlib.bzrdir import BzrDir
-from bzrlib.errors import NoSuchRevision, BzrError, UninitializableFormat
+from bzrlib.errors import NoSuchRevision, UninitializableFormat
from bzrlib.inventory import Inventory
-import bzrlib.osutils as osutils
from bzrlib.repository import Repository
from bzrlib.revision import NULL_REVISION
from bzrlib.tests import TestCase
-from bzrlib.trace import mutter
-from bzrlib.transport.local import LocalTransport
import os
import svn.fs
from convert import load_dumpfile
-import errors
-from fileids import generate_file_id, generate_svn_file_id
+from fileids import generate_svn_file_id, generate_file_id
import format
from scheme import TrunkBranchingScheme, NoBranchingScheme
from transport import SvnRaTransport
from tests import TestCaseWithSubversionRepository
-import repository
from repository import (parse_svn_revision_id, generate_svn_revision_id,
svk_feature_to_revision_id, revision_id_to_svk_feature,
MAPPING_VERSION, escape_svn_path, unescape_svn_path,
@@ -390,6 +385,17 @@
self.assertEqual(author, rev.committer)
self.assertIsInstance(rev.properties, dict)
+ def test_get_revision_zero(self):
+ repos_url = self.make_client('d', 'dc')
+ repository = Repository.open("svn+%s" % repos_url)
+ rev = repository.get_revision(
+ repository.generate_revision_id(0, ""))
+ self.assertEqual(repository.generate_revision_id(0, ""), rev.revision_id)
+ self.assertEqual("", rev.committer)
+ self.assertEqual({}, rev.properties)
+ self.assertEqual(None, rev.timezone)
+ self.assertEqual(0.0, rev.timestamp)
+
def test_get_ancestry(self):
repos_url = self.make_client('d', 'dc')
repository = Repository.open("svn+%s" % repos_url)
@@ -440,6 +446,12 @@
self.assertEqual({repository.generate_revision_id(0, ""): []},
repository.get_revision_graph())
+ def test_get_revision_graph_zero(self):
+ repos_url = self.make_client('d', 'dc')
+ repository = Repository.open(repos_url)
+ self.assertEqual({repository.generate_revision_id(0, ""): []},
+ repository.get_revision_graph(repository.generate_revision_id(0, "")))
+
def test_get_revision_graph_all(self):
repos_url = self.make_client('d', 'dc')
self.build_tree({'dc/trunk/a': 'data', 'dc/branches/foo/b': 'alsodata'})
=== modified file 'tests/test_transport.py'
--- a/tests/test_transport.py 2007-03-15 17:09:40 +0000
+++ b/tests/test_transport.py 2007-03-25 18:41:40 +0000
@@ -15,7 +15,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from tests import TestCaseWithSubversionRepository
-from bzrlib.bzrdir import BzrDir
from bzrlib.errors import NotBranchError, NoSuchFile, FileExists
from transport import SvnRaTransport, bzr_to_svn_url
from unittest import TestCase
@@ -135,7 +134,7 @@
t.mkdir("bla")
self.assertRaises(FileExists, t.mkdir, "bla")
- def test_clone(self):
+ def test_clone2(self):
repos_url = self.make_client('d', 'dc')
self.build_tree({"dc/dir": None, "dc/bl": "data"})
self.client_add("dc/dir")
=== modified file 'tests/test_tree.py'
--- a/tests/test_tree.py 2007-01-14 05:57:00 +0000
+++ b/tests/test_tree.py 2007-03-25 18:41:40 +0000
@@ -14,9 +14,6 @@
# 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.bzrdir import BzrDir
-from bzrlib.errors import NoRepositoryPresent
-from bzrlib.tests import TestCase
from bzrlib.workingtree import WorkingTree
from tree import SvnBasisTree
@@ -24,7 +21,7 @@
class TestBasisTree(TestCaseWithSubversionRepository):
def test_executable(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
self.build_tree({"dc/file": "x"})
self.client_add("dc/file")
self.client_set_prop("dc/file", "svn:executable", "*")
@@ -33,7 +30,7 @@
self.assertTrue(tree.inventory[tree.inventory.path2id("file")].executable)
def test_executable_changed(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
self.build_tree({"dc/file": "x"})
self.client_add("dc/file")
self.client_commit("dc", "executable")
@@ -43,7 +40,7 @@
self.assertFalse(tree.inventory[tree.inventory.path2id("file")].executable)
def test_symlink(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
import os
os.symlink("target", "dc/file")
self.build_tree({"dc/file": "x"})
@@ -57,7 +54,7 @@
tree.inventory[tree.inventory.path2id("file")].symlink_target)
def test_symlink_next(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
import os
os.symlink("target", "dc/file")
self.build_tree({"dc/file": "x", "dc/bla": "p"})
@@ -74,7 +71,7 @@
tree.inventory[tree.inventory.path2id("file")].symlink_target)
def test_executable_link(self):
- repos_url = self.make_client("d", "dc")
+ self.make_client("d", "dc")
import os
os.symlink("target", "dc/file")
self.build_tree({"dc/file": "x"})
=== modified file 'tests/test_upgrade.py'
--- a/tests/test_upgrade.py 2007-03-16 00:25:16 +0000
+++ b/tests/test_upgrade.py 2007-03-25 18:41:40 +0000
@@ -15,14 +15,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from bzrlib.bzrdir import BzrDir
-from bzrlib.errors import NoRepositoryPresent, InvalidRevisionId
+from bzrlib.errors import InvalidRevisionId
from bzrlib.repository import Repository
from bzrlib.tests import TestCase, TestCaseWithTransport
-from bzrlib.trace import mutter
from fileids import generate_svn_file_id
-import repository
-from repository import SvnRepository, MAPPING_VERSION, REVISION_ID_PREFIX
+from repository import MAPPING_VERSION
from tests import TestCaseWithSubversionRepository
from upgrade import (change_revision_parent, upgrade_repository, upgrade_branch,
UpgradeChangesContent, parse_legacy_revision_id,
@@ -264,7 +262,7 @@
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f")
- newrepos = dir.create_repository()
+ dir.create_repository()
b = dir.create_branch()
wt = dir.create_workingtree()
file("f/a", "w").write("b")
@@ -287,7 +285,7 @@
oldrepos = Repository.open(repos_url)
dir = BzrDir.create("f")
- newrepos = dir.create_repository()
+ dir.create_repository()
b = dir.create_branch()
wt = dir.create_workingtree()
file("f/a", "w").write("c")
=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py 2007-03-16 12:09:02 +0000
+++ b/tests/test_workingtree.py 2007-03-25 18:41:40 +0000
@@ -14,9 +14,8 @@
# 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
from bzrlib.bzrdir import BzrDir
-from bzrlib.errors import NoSuchRevision, NoSuchFile
+from bzrlib.errors import NoSuchFile
from bzrlib.inventory import Inventory
from bzrlib.revision import NULL_REVISION
from bzrlib.trace import mutter
@@ -28,10 +27,7 @@
import os
from fileids import generate_svn_file_id
-import format
-import checkout
from repository import MAPPING_VERSION
-import tree
from tests import TestCaseWithSubversionRepository, RENAMES
class TestWorkingTree(TestCaseWithSubversionRepository):
@@ -260,7 +256,7 @@
self.client_commit("dc", "Bla")
self.build_tree({"dc/bl": "data2"})
tree = WorkingTree.open("dc")
- basis = tree.basis_tree()
+ tree.basis_tree()
delta = tree.changes_from(tree.basis_tree())
self.assertEqual("bl", delta.modified[0][0])
@@ -347,7 +343,6 @@
def test_symlink(self):
self.make_client('a', 'dc')
- import os
os.symlink("target", "dc/bla")
self.client_add("dc/bla")
tree = WorkingTree.open("dc")
@@ -393,7 +388,7 @@
self.build_tree({"dc/bl": "data"})
self.client_add("dc/bl")
tree = WorkingTree.open("dc")
- orig_tree = tree.basis_tree()
+ tree.basis_tree()
tree.commit(message_callback=lambda x: "data")
def test_commit_callback_unicode(self):
@@ -401,7 +396,7 @@
self.build_tree({"dc/bl": "data"})
self.client_add("dc/bl")
tree = WorkingTree.open("dc")
- orig_tree = tree.basis_tree()
+ tree.basis_tree()
tree.commit(message_callback=lambda x: u"data")
def test_commit_message_unicode(self):
@@ -420,7 +415,7 @@
self.make_checkout(repos_url + "/branches/foobranch", "de")
tree = WorkingTree.open("de")
self.build_tree({'de/file': "foo"})
- orig_tree = tree.basis_tree()
+ tree.basis_tree()
tree.commit(message="data")
def test_update_after_commit(self):
=== modified file 'transport.py'
--- a/transport.py 2007-03-15 16:40:04 +0000
+++ b/transport.py 2007-03-25 18:41:40 +0000
@@ -20,10 +20,6 @@
from bzrlib.transport import Transport
import bzrlib.urlutils as urlutils
-from cStringIO import StringIO
-import os
-from tempfile import mktemp
-
from svn.core import SubversionException, Pool
import svn.ra
import svn.core
@@ -109,7 +105,7 @@
mutter('opening SVN RA connection to %r' % self.svn_url)
self._ra = svn.client.open_ra_session(self.svn_url.encode('utf8'),
self._client, self.pool)
- except SubversionException, (msg, num):
+ except SubversionException, (_, num):
if num in (svn.core.SVN_ERR_RA_ILLEGAL_URL, \
svn.core.SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, \
svn.core.SVN_ERR_BAD_URL):
=== modified file 'tree.py'
--- a/tree.py 2007-03-25 14:20:08 +0000
+++ b/tree.py 2007-03-25 18:41:40 +0000
@@ -14,15 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from binascii import hexlify
-from bzrlib.bzrdir import BzrDirFormat
-from bzrlib.errors import NotBranchError, NoSuchFile
-from bzrlib.inventory import (Inventory, InventoryDirectory, InventoryFile)
-from bzrlib.lockable_files import TransportLock, LockableFiles
-from bzrlib.lockdir import LockDir
+from bzrlib.inventory import Inventory
import bzrlib.osutils as osutils
-from bzrlib.progress import DummyProgress
-from bzrlib.revision import NULL_REVISION
from bzrlib.trace import mutter
from bzrlib.revisiontree import RevisionTree
@@ -32,7 +25,7 @@
import urllib
import svn.core, svn.wc, svn.delta
-from svn.core import SubversionException, Pool
+from svn.core import Pool
def apply_txdelta_handler(src_stream, target_stream, pool):
assert hasattr(src_stream, 'read')
@@ -50,7 +43,7 @@
return wrapper
class SvnRevisionTree(RevisionTree):
- def __init__(self, repository, revision_id, inventory=None):
+ def __init__(self, repository, revision_id):
self._repository = repository
self._revision_id = revision_id
pool = Pool()
@@ -68,7 +61,7 @@
reporter.finish_report(pool)
pool.destroy()
- def get_file_lines(self, file_id):
+ def get_file_lines(self, file_id):
return osutils.split_lines(self.file_data[file_id])
=== modified file 'upgrade.py'
--- a/upgrade.py 2007-03-19 11:23:36 +0000
+++ b/upgrade.py 2007-03-25 18:41:40 +0000
@@ -94,7 +94,7 @@
try:
for path, ie in oldinv.iter_entries():
pb.update('upgrading revision', i, total)
- i+=1
+ i += 1
new_ie = ie.copy()
if new_ie.revision == oldrevid:
new_ie.revision = None
@@ -193,9 +193,9 @@
try:
for revid in graph:
pb.update('gather revision information', i, len(graph))
- i+=1
+ i += 1
try:
- (uuid, bp, rev, version) = parse_legacy_revision_id(revid)
+ (uuid, bp, rev, _) = parse_legacy_revision_id(revid)
newrevid = generate_svn_revision_id(uuid, rev, bp)
if svn_repository.has_revision(newrevid):
rename_map[revid] = newrevid
@@ -237,7 +237,7 @@
for revid in needed_revs:
pb.update('fetching new revisions', i, len(needed_revs))
repository.fetch(svn_repository, revid)
- i+=1
+ i += 1
finally:
pb.finished()
@@ -248,7 +248,7 @@
while len(needs_upgrading) > 0:
revid = needs_upgrading.pop()
pb.update('upgrading revisions', i, total)
- i+=1
+ i += 1
newrevid = create_upgraded_revid(revid)
rename_map[revid] = newrevid
if repository.has_revision(newrevid):
More information about the bazaar-commits
mailing list