Rev 4122: (jam) Add a nostore_sha tests for VF implementations. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Mar 12 02:59:11 GMT 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4122
revision-id: pqm at pqm.ubuntu.com-20090312025908-v6s9pjhxubuqrnxe
parent: pqm at pqm.ubuntu.com-20090312021804-624908fcy28eisfn
parent: john at arbash-meinel.com-20090312002859-ay54agwgzxpyt9zx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-03-12 02:59:08 +0000
message:
(jam) Add a nostore_sha tests for VF implementations.
modified:
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
------------------------------------------------------------
revno: 4119.1.1
revision-id: john at arbash-meinel.com-20090312002859-ay54agwgzxpyt9zx
parent: pqm at pqm.ubuntu.com-20090312001649-6tvc2mmeyw992st3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: vf_tests
timestamp: Wed 2009-03-11 19:28:59 -0500
message:
Move the 'add_lines_nostoresha' to being tested against all VF implementations.
modified:
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py 2009-03-11 07:59:06 +0000
+++ b/bzrlib/tests/test_versionedfile.py 2009-03-12 00:28:59 +0000
@@ -1493,6 +1493,27 @@
trailing_eol=trailing_eol, nograph=not self.graph,
left_only=left_only)
+ def test_add_lines_nostoresha(self):
+ """When nostore_sha is supplied using old content raises."""
+ vf = self.get_versionedfiles()
+ empty_text = ('a', [])
+ sample_text_nl = ('b', ["foo\n", "bar\n"])
+ sample_text_no_nl = ('c', ["foo\n", "bar"])
+ shas = []
+ for version, lines in (empty_text, sample_text_nl, sample_text_no_nl):
+ sha, _, _ = vf.add_lines(self.get_simple_key(version), [], lines)
+ shas.append(sha)
+ # we now have a copy of all the lines in the vf.
+ for sha, (version, lines) in zip(
+ shas, (empty_text, sample_text_nl, sample_text_no_nl)):
+ new_key = self.get_simple_key(version + "2")
+ self.assertRaises(errors.ExistingContent,
+ vf.add_lines, new_key, [], lines,
+ nostore_sha=sha)
+ # and no new version should have been added.
+ record = vf.get_record_stream([new_key], 'unordered', True).next()
+ self.assertEqual('absent', record.storage_kind)
+
def test_add_lines_return(self):
files = self.get_versionedfiles()
# save code by using the stock data insertion helper.
More information about the bazaar-commits
mailing list