[Pkg-bazaar-commits] ./bzr-builddeb/trunk r351: Make upstream-version oriented methods take just upstream versions.
James Westby
james.westby at canonical.com
Wed Jul 15 18:36:36 UTC 2009
------------------------------------------------------------
revno: 351
author: Jelmer Vernooij <jelmer at samba.org>
committer: James Westby <james.westby at canonical.com>
branch nick: trunk
timestamp: Wed 2009-07-15 19:36:36 +0100
message:
Make upstream-version oriented methods take just upstream versions.
This should save bugs with taking .upstream_version too many or too few
times.
Thanks Jelmer.
modified:
cmds.py
import_dsc.py
tests/test_import_dsc.py
tests/test_upstream.py
upstream.py
-------------- next part --------------
=== modified file 'cmds.py'
--- a/cmds.py 2009-07-15 18:17:12 +0000
+++ b/cmds.py 2009-07-15 18:36:36 +0000
@@ -704,7 +704,7 @@
try:
if last_version is not None:
if not db.has_upstream_version_in_packaging_branch(
- last_version):
+ last_version.upstream_version):
raise BzrCommandError("Unable to find the tag for "
"the previous upstream version, %s, in the "
"branch: %s" % (last_version,
=== modified file 'import_dsc.py'
--- a/import_dsc.py 2009-07-04 20:45:01 +0000
+++ b/import_dsc.py 2009-07-15 18:36:36 +0000
@@ -505,7 +505,8 @@
part of the version number from.
:return: a String with the name of the tag.
"""
- tag_name = self.tag_name(version.upstream_version)
+ assert isinstance(version, str)
+ tag_name = self.tag_name(version)
if distro is None:
return "upstream-" + tag_name
return "upstream-%s-%s" % (distro, tag_name)
@@ -564,8 +565,8 @@
string passed must the the md5sum that is associated with the
revision pointed to by the tag.
- :param version: a Version object from which to extract the upstream
- version number to look for in the upstream branch.
+ :param version: a upstream version number to look for in the upstream
+ branch.
:param md5: a string with the md5sum that if not None must be
associated with the revision.
:return: True if the upstream branch contains the specified upstream
@@ -583,6 +584,7 @@
return False
def has_upstream_version_in_packaging_branch(self, version, md5=None):
+ assert isinstance(version, str)
tag_name = self.upstream_tag_name(version)
if self._has_version(self.branch, tag_name, md5=md5):
return True
@@ -722,9 +724,10 @@
Sets a tag on the last revision of the upstream branch with a tag
that refers to the upstream part of the version provided.
- :param version: the Version object from which to extract the upstream
- part of the version number to derive the tag name from.
+ :param version: the upstream part of the version number to derive the
+ tag name from.
"""
+ assert isinstance(version, str)
tag_name = self.upstream_tag_name(version)
self.upstream_branch.tags.set_tag(tag_name,
self.upstream_branch.last_revision())
@@ -843,13 +846,14 @@
indicates that a pull should be done from that branch, rather
than importing the upstream as a new revision in this branch.
- :param version: the Version object to use the upstream part
- of when searching in the lesser branches.
+ :param version: the upstream version to use when searching in the
+ lesser branches.
:param md5: a String containing the md5 associateed with the
upstream version.
:return: a DistributionBranch object to pull the upstream from
if that is what should be done, otherwise None.
"""
+ assert isinstance(version, str)
assert md5 is not None, \
("It's not a good idea to use branch_to_pull_upstream_from with "
"md5 == None, as you may pull the wrong revision.")
@@ -968,11 +972,12 @@
recognised as being part of this branch.
:param pull_branch: the DistributionBranch to pull from.
- :param version: the Version to use the upstream part of.
+ :param version: the upstream version string
"""
+ assert isinstance(version, str)
pull_revision = pull_branch.revid_of_upstream_version(version)
mutter("Pulling upstream part of %s from revision %s" % \
- (str(version), pull_revision))
+ (version, pull_revision))
up_pull_branch = pull_branch.upstream_branch
assert self.upstream_tree is not None, \
"Can't pull upstream with no tree"
@@ -1009,9 +1014,10 @@
assert self.tree is not None, "Can't pull branch with no tree"
self.tree.pull(pull_branch.branch, stop_revision=pull_revision)
self.tag_version(version)
- if not native and not self.has_upstream_version(version):
- if pull_branch.has_upstream_version(version):
- self.pull_upstream_from_branch(pull_branch, version)
+ if not native and not self.has_upstream_version(version.upstream_version):
+ if pull_branch.has_upstream_version(version.upstream_version):
+ self.pull_upstream_from_branch(pull_branch,
+ version.upstream_version)
else:
assert False, ("Can't find the needed upstream part "
"for version %s" % version)
@@ -1064,7 +1070,7 @@
break
real_parents = [p[2] for p in parents]
if need_upstream_parent:
- parent_revid = self.revid_of_upstream_version(version)
+ parent_revid = self.revid_of_upstream_version(version.upstream_version)
if len(parents) > 0:
real_parents.insert(1, parent_revid)
else:
@@ -1106,7 +1112,7 @@
:param upstream_part: the path of a directory containing the
unpacked upstream part of the source package.
- :param version: the Version of the package that is being imported.
+ :param version: upstream version that is being imported
:param md5: the md5 of the upstream part.
:param upstream_parents: the parents to give the upstream revision
:param timestamp: a tuple of (timestamp, timezone) to use for
@@ -1117,6 +1123,7 @@
# from lesser branches first? For now we'll just dump it on.
# TODO: this method needs a lot of work for when we will make
# the branches writeable by others.
+ assert isinstance(version, str)
mutter("Importing upstream version %s from %s with parents %s" \
% (version, upstream_part, str(upstream_parents)))
assert self.upstream_tree is not None, \
@@ -1158,7 +1165,7 @@
timezone = timestamp[1]
timestamp = timestamp[0]
revid = self.upstream_tree.commit("Import upstream version %s" \
- % (str(version.upstream_version),),
+ % (version,),
revprops=revprops, timestamp=timestamp, timezone=timezone)
self.tag_upstream_version(version)
return revid
@@ -1358,7 +1365,7 @@
# upstream as a non-native version (i.e. it wasn't a mistaken
# native -2 version), then we want to add an extra parent.
if (self.is_version_native(last_contained_version)
- and not self.has_upstream_version(last_contained_version)):
+ and not self.has_upstream_version(last_contained_version.upstream_version)):
revid = self.revid_of_version(last_contained_version)
parents.append(revid)
self.upstream_branch.fetch(self.branch,
@@ -1374,7 +1381,7 @@
pull_version = pull_parents[1][1]
if not pull_branch.is_version_native(pull_version):
pull_revid = \
- pull_branch.revid_of_upstream_version(pull_version)
+ pull_branch.revid_of_upstream_version(pull_version.upstream_version)
mutter("Initialising upstream from %s, version %s" \
% (str(pull_branch), str(pull_version)))
parents.append(pull_revid)
@@ -1407,7 +1414,8 @@
timestamp=None, author=None):
pull_branch = self.branch_to_pull_version_from(version, md5)
if pull_branch is not None:
- if (self.branch_to_pull_upstream_from(version, upstream_md5)
+ if (self.branch_to_pull_upstream_from(version.upstream_version,
+ upstream_md5)
is None):
pull_branch = None
if pull_branch is not None:
@@ -1416,18 +1424,21 @@
# We need to import at least the diff, possibly upstream.
# Work out if we need the upstream part first.
imported_upstream = False
- if not self.has_upstream_version(version):
+ if not self.has_upstream_version(version.upstream_version):
up_pull_branch = \
- self.branch_to_pull_upstream_from(version, upstream_md5)
+ self.branch_to_pull_upstream_from(version.upstream_version,
+ upstream_md5)
if up_pull_branch is not None:
- self.pull_upstream_from_branch(up_pull_branch, version)
+ self.pull_upstream_from_branch(up_pull_branch,
+ version.upstream_version)
else:
imported_upstream = True
# Check whether we should pull first if this initialises
# from another branch:
upstream_parents = self.upstream_parents(versions,
- version)
- new_revid = self.import_upstream(upstream_part, version,
+ version.upstream_version)
+ new_revid = self.import_upstream(upstream_part,
+ version.upstream_version,
upstream_md5, upstream_parents,
upstream_tarball=upstream_tarball,
timestamp=timestamp, author=author)
@@ -1624,7 +1635,7 @@
try:
if previous_version is not None:
if not self.has_upstream_version_in_packaging_branch(
- previous_version):
+ previous_version.upstream_version):
raise BzrCommandError("Unable to find the tag for the "
"previous upstream version, %s, in the branch: "
"%s" % (previous_version,
@@ -1634,7 +1645,7 @@
self._extract_upstream_tree(upstream_tip, tempdir)
else:
self._create_empty_upstream_tree(tempdir)
- if self.has_upstream_version_in_packaging_branch(version):
+ if self.has_upstream_version_in_packaging_branch(version.upstream_version):
raise UpstreamAlreadyImported(version)
try:
if upstream_branch is not None:
@@ -1691,6 +1702,7 @@
def reconstruct_pristine_tar(self, revid, package, version,
dest_filename):
+ """Reconstruct a pristine-tar tarball from a bzr revision."""
if not os.path.exists("/usr/bin/pristine-tar"):
raise PristineTarError("/usr/bin/pristine-tar is not available")
tree = self.branch.repository.revision_tree(revid)
=== modified file 'tests/test_import_dsc.py'
--- a/tests/test_import_dsc.py 2009-07-10 17:43:12 +0000
+++ b/tests/test_import_dsc.py 2009-07-15 18:36:36 +0000
@@ -118,9 +118,7 @@
def test_upstream_tag_name(self):
db = self.db1
upstream_v_no = "0.1"
- version_no = upstream_v_no + "-1"
- version = Version(version_no)
- self.assertEqual(db.upstream_tag_name(version),
+ self.assertEqual(db.upstream_tag_name(upstream_v_no),
"upstream-" + upstream_v_no)
def test_tag_version(self):
@@ -135,7 +133,7 @@
def test_tag_upstream_version(self):
db = self.db1
tree = self.up_tree1
- version = Version("0.1-1")
+ version = "0.1"
revid = tree.commit("one")
db.tag_upstream_version(version)
tag_name = db.upstream_tag_name(version)
@@ -158,7 +156,7 @@
def test_has_upstream_version(self):
db = self.db1
- version = Version("0.1-1")
+ version = "0.1"
self.assertFalse(db.has_upstream_version(version))
self.assertFalse(db.has_upstream_version(version, self.fake_md5_1))
self.do_commit_with_md5(self.up_tree1, "one", self.fake_md5_1)
@@ -166,11 +164,11 @@
self.assertTrue(db.has_upstream_version(version))
self.assertTrue(db.has_upstream_version(version, self.fake_md5_1))
self.assertFalse(db.has_upstream_version(version, self.fake_md5_2))
- version = Version("0.1-2")
+ version = "0.1"
self.assertTrue(db.has_upstream_version(version))
self.assertTrue(db.has_upstream_version(version, self.fake_md5_1))
self.assertFalse(db.has_upstream_version(version, self.fake_md5_2))
- version = Version("0.2-1")
+ version = "0.2"
self.assertFalse(db.has_upstream_version(version))
self.assertFalse(db.has_upstream_version(version, self.fake_md5_1))
self.assertFalse(db.has_upstream_version(version, self.fake_md5_2))
@@ -186,7 +184,7 @@
def test_revid_of_upstream_version(self):
db = self.db1
tree = self.up_tree1
- version = Version("0.1-1")
+ version = "0.1"
revid = tree.commit("one")
db.tag_upstream_version(version)
self.assertEqual(db.revid_of_upstream_version(version), revid)
@@ -378,12 +376,12 @@
db = self.db1
version1 = Version("0.1-1")
up_revid = self.up_tree1.commit("one")
- db.tag_upstream_version(version1)
+ db.tag_upstream_version(version1.upstream_version)
self.assertEqual(db.get_parents_with_upstream(version1, [version1]),
[up_revid])
db = self.db2
self.up_tree2.pull(self.up_tree1.branch)
- db.tag_upstream_version(version1)
+ db.tag_upstream_version(version1.upstream_version)
self.assertEqual(db.get_parents_with_upstream(version1, [version1]),
[up_revid])
@@ -394,7 +392,7 @@
revid1 = self.tree1.commit("one")
db.tag_version(version1)
up_revid = self.up_tree1.commit("upstream one")
- db.tag_upstream_version(version1)
+ db.tag_upstream_version(version1.upstream_version)
# No upstream parent
self.assertEqual(db.get_parents_with_upstream(version2,
[version2, version1]), [revid1])
@@ -409,8 +407,8 @@
self.db2.tag_version(version2)
up_revid1 = self.up_tree1.commit("upstream one")
self.up_tree2.pull(self.up_tree1.branch)
- self.db1.tag_upstream_version(version1)
- self.db2.tag_upstream_version(version2)
+ self.db1.tag_upstream_version(version1.upstream_version)
+ self.db2.tag_upstream_version(version2.upstream_version)
versions = [version3, version1, version2]
# No upstream parent
self.assertEqual(self.db2.get_parents_with_upstream(version3,
@@ -426,8 +424,8 @@
self.db2.tag_version(version2)
up_revid1 = self.up_tree1.commit("upstream one")
self.up_tree2.pull(self.up_tree1.branch)
- self.db1.tag_upstream_version(version1)
- self.db2.tag_upstream_version(version2)
+ self.db1.tag_upstream_version(version1.upstream_version)
+ self.db2.tag_upstream_version(version2.upstream_version)
versions = [version3, version2, version1]
# No upstream parent
self.assertEqual(self.db1.get_parents_with_upstream(version3,
@@ -442,8 +440,8 @@
self.db2.tag_version(version1)
up_revid1 = self.up_tree1.commit("upstream one")
up_revid2 = self.up_tree2.commit("upstream two")
- self.db1.tag_upstream_version(version1)
- self.db2.tag_upstream_version(version2)
+ self.db1.tag_upstream_version(version1.upstream_version)
+ self.db2.tag_upstream_version(version2.upstream_version)
versions = [version2, version1]
# Upstream parent as it is new upstream version
self.assertEqual(self.db2.get_parents_with_upstream(version2,
@@ -461,13 +459,13 @@
revid3 = self.tree1.commit("three")
self.db1.tag_version(version3)
up_revid1 = self.up_tree1.commit("upstream one")
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version2)
+ self.db2.tag_upstream_version(version2.upstream_version)
up_revid2 = self.up_tree1.commit("upstream two")
- self.db1.tag_upstream_version(version3)
+ self.db1.tag_upstream_version(version3.upstream_version)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version4)
+ self.db2.tag_upstream_version(version4.upstream_version)
versions = [version4, version3, version2, version1]
# no upstream parent as the lesser branch has already merged it
self.assertEqual(self.db2.get_parents_with_upstream(version4,
@@ -479,9 +477,9 @@
revid1 = self.tree1.commit("one")
self.db1.tag_version(version1)
up_revid1 = self.up_tree1.commit("upstream one")
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
up_revid2 = self.up_tree2.commit("different upstream one")
- self.db2.tag_upstream_version(version2)
+ self.db2.tag_upstream_version(version2.upstream_version)
versions = [version2, version1]
# a previous test checked that this wouldn't give an
# upstream parent, but we are requiring one.
@@ -500,9 +498,9 @@
self.db2.tag_version(version2)
self.db1.tag_version(version3)
up_revid1 = self.up_tree1.commit("upstream one")
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version2)
+ self.db2.tag_upstream_version(version2.upstream_version)
versions = [version3, version2, version1]
# This is a sync but we are diverged so we should get two
# parents
@@ -520,11 +518,11 @@
self.db2.tag_version(version2)
self.db1.tag_version(version3)
up_revid1 = self.up_tree1.commit("upstream one")
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version2)
+ self.db2.tag_upstream_version(version2.upstream_version)
up_revid2 = self.up_tree1.commit("upstream two")
- self.db1.tag_upstream_version(version3)
+ self.db1.tag_upstream_version(version3.upstream_version)
versions = [version3, version2, version1]
# This a sync, but we are diverged, so we should get two
# parents. There should be no upstream as the synced
@@ -543,14 +541,14 @@
self.db2.tag_version(version2)
self.db1.tag_version(version3)
up_revid1 = self.up_tree1.commit("upstream one")
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version2)
+ self.db2.tag_upstream_version(version2.upstream_version)
up_revid2 = self.up_tree1.commit("upstream two")
- self.db1.tag_upstream_version(version3)
+ self.db1.tag_upstream_version(version3.upstream_version)
versions = [version3, version2, version1]
up_revid3 = self.up_tree2.commit("different upstream two")
- self.db2.tag_upstream_version(version3)
+ self.db2.tag_upstream_version(version3.upstream_version)
versions = [version3, version2, version1]
# test_get_parents_with_upstream_sync_new_upstream
# checks that there is not normally an upstream parent
@@ -617,57 +615,57 @@
version1 = Version("0.1-1")
version2 = Version("0.2-1")
# With no versions tagged everything is None
- branch = self.db2.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
- self.assertEqual(branch, None)
- branch = self.db2.branch_to_pull_upstream_from(version1,
- self.fake_md5_2)
- self.assertEqual(branch, None)
- branch = self.db1.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
+ branch = self.db2.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
+ self.assertEqual(branch, None)
+ branch = self.db2.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_2)
+ self.assertEqual(branch, None)
+ branch = self.db1.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
self.assertEqual(branch, None)
self.do_commit_with_md5(self.up_tree1, "one", self.fake_md5_1)
- self.db1.tag_upstream_version(version1)
+ self.db1.tag_upstream_version(version1.upstream_version)
# Version and md5 available, so we get the correct branch.
- branch = self.db2.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
+ branch = self.db2.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
self.assertEqual(branch, self.db1)
# Otherwise (different version or md5) then we get None
- branch = self.db2.branch_to_pull_upstream_from(version1,
- self.fake_md5_2)
+ branch = self.db2.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_2)
self.assertEqual(branch, None)
- branch = self.db2.branch_to_pull_upstream_from(version2,
+ branch = self.db2.branch_to_pull_upstream_from(version2.upstream_version,
self.fake_md5_1)
self.assertEqual(branch, None)
- branch = self.db2.branch_to_pull_upstream_from(version2,
+ branch = self.db2.branch_to_pull_upstream_from(version2.upstream_version,
self.fake_md5_2)
self.assertEqual(branch, None)
# And we don't get a branch for the one that already has
# the version
- branch = self.db1.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
+ branch = self.db1.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
self.assertEqual(branch, None)
self.up_tree2.pull(self.up_tree1.branch)
- self.db2.tag_upstream_version(version1)
+ self.db2.tag_upstream_version(version1.upstream_version)
# And we get the greatest branch when two lesser branches
# have what we are looking for.
- branch = self.db3.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
+ branch = self.db3.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
self.assertEqual(branch, self.db2)
# If the branches have diverged then we don't get a branch.
self.up_tree3.commit("three")
- branch = self.db3.branch_to_pull_upstream_from(version1,
- self.fake_md5_1)
+ branch = self.db3.branch_to_pull_upstream_from(
+ version1.upstream_version, self.fake_md5_1)
self.assertEqual(branch, None)
def test_pull_from_lesser_branch_no_upstream(self):
version = Version("0.1-1")
self.do_commit_with_md5(self.up_tree1, "upstream one",
self.fake_md5_1)
- self.db1.tag_upstream_version(version)
+ self.db1.tag_upstream_version(version.upstream_version)
up_revid = self.do_commit_with_md5(self.up_tree2, "upstream two",
self.fake_md5_1)
- self.db2.tag_upstream_version(version)
+ self.db2.tag_upstream_version(version.upstream_version)
revid = self.do_commit_with_md5(self.tree1, "one", self.fake_md5_2)
self.db1.tag_version(version)
self.assertNotEqual(self.tree2.branch.last_revision(), revid)
@@ -675,14 +673,14 @@
self.assertEqual(self.tree2.branch.last_revision(), revid)
self.assertEqual(self.up_tree2.branch.last_revision(), up_revid)
self.assertEqual(self.db2.revid_of_version(version), revid)
- self.assertEqual(self.db2.revid_of_upstream_version(version),
- up_revid)
+ self.assertEqual(self.db2.revid_of_upstream_version(
+ version.upstream_version), up_revid)
def test_pull_from_lesser_branch_with_upstream(self):
version = Version("0.1-1")
up_revid = self.do_commit_with_md5(self.up_tree1, "upstream one",
self.fake_md5_1)
- self.db1.tag_upstream_version(version)
+ self.db1.tag_upstream_version(version.upstream_version)
revid = self.do_commit_with_md5(self.tree1, "one", self.fake_md5_2)
self.db1.tag_version(version)
self.assertNotEqual(self.tree2.branch.last_revision(), revid)
@@ -691,11 +689,11 @@
self.assertEqual(self.tree2.branch.last_revision(), revid)
self.assertEqual(self.up_tree2.branch.last_revision(), up_revid)
self.assertEqual(self.db2.revid_of_version(version), revid)
- self.assertEqual(self.db2.revid_of_upstream_version(version),
- up_revid)
+ self.assertEqual(self.db2.revid_of_upstream_version(
+ version.upstream_version), up_revid)
def test_pull_upstream_from_branch(self):
- version = Version("0.1-1")
+ version = "0.1"
up_revid = self.do_commit_with_md5(self.up_tree1, "upstream one",
self.fake_md5_1)
self.db1.tag_upstream_version(version)
@@ -767,12 +765,14 @@
os.mkdir(basedir)
write_to_file(os.path.join(basedir, "README"), "Hi\n")
write_to_file(os.path.join(basedir, "BUGS"), "")
- self.db1.import_upstream(basedir, version, self.fake_md5_1, [])
+ self.db1.import_upstream(basedir, version.upstream_version,
+ self.fake_md5_1, [])
tree = self.up_tree1
branch = tree.branch
rh = branch.revision_history()
self.assertEqual(len(rh), 1)
- self.assertEqual(self.db1.revid_of_upstream_version(version), rh[0])
+ self.assertEqual(self.db1.revid_of_upstream_version(
+ version.upstream_version), rh[0])
rev = branch.repository.get_revision(rh[0])
self.assertEqual(rev.message,
"Import upstream version %s" % str(version.upstream_version))
@@ -787,19 +787,21 @@
write_to_file(os.path.join(basedir, "README"), "Hi\n")
write_to_file(os.path.join(basedir, "BUGS"), "")
write_to_file(os.path.join(basedir, "COPYING"), "")
- self.db1.import_upstream(basedir, version1, self.fake_md5_1, [])
+ self.db1.import_upstream(basedir, version1.upstream_version,
+ self.fake_md5_1, [])
basedir = name + "-" + str(version2.upstream_version)
os.mkdir(basedir)
write_to_file(os.path.join(basedir, "README"), "Now even better\n")
write_to_file(os.path.join(basedir, "BUGS"), "")
write_to_file(os.path.join(basedir, "NEWS"), "")
- self.db1.import_upstream(basedir, version2, self.fake_md5_2,
+ self.db1.import_upstream(basedir, version2.upstream_version,
+ self.fake_md5_2,
[self.up_tree1.branch.last_revision()])
tree = self.up_tree1
branch = tree.branch
rh = branch.revision_history()
self.assertEqual(len(rh), 2)
- self.assertEqual(self.db1.revid_of_upstream_version(version2), rh[1])
+ self.assertEqual(self.db1.revid_of_upstream_version(version2.upstream_version), rh[1])
rev = branch.repository.get_revision(rh[1])
self.assertEqual(rev.message,
"Import upstream version %s" % str(version2.upstream_version))
@@ -1241,7 +1243,8 @@
self.assertEqual(self.db1.revid_of_version(version1), rh1[1])
self.assertEqual(self.db1.revid_of_version(version2), rh1[2])
self.assertEqual(self.db1.revid_of_version(version3), rh1[3])
- self.assertEqual(self.db1.revid_of_upstream_version(version1),
+ self.assertEqual(
+ self.db1.revid_of_upstream_version(version1.upstream_version),
up_rh1[0])
self.tree1.lock_read()
self.addCleanup(self.tree1.unlock)
@@ -1293,9 +1296,11 @@
self.assertEqual(self.db1.revid_of_version(version1), rh1[1])
self.assertEqual(self.db1.revid_of_version(version2), rh1[2])
self.assertEqual(self.db1.revid_of_version(version3), rh1[3])
- self.assertEqual(self.db1.revid_of_upstream_version(version1),
+ self.assertEqual(
+ self.db1.revid_of_upstream_version(version1.upstream_version),
up_rh1[0])
- self.assertEqual(self.db1.revid_of_upstream_version(version3),
+ self.assertEqual(
+ self.db1.revid_of_upstream_version(version3.upstream_version),
up_rh1[1])
self.tree1.lock_read()
self.addCleanup(self.tree1.unlock)
@@ -1346,9 +1351,11 @@
self.assertEqual(self.db1.revid_of_version(version1), rh1[1])
self.assertEqual(self.db1.revid_of_version(version2), rh1[2])
self.assertEqual(self.db1.revid_of_version(version3), rh1[3])
- self.assertEqual(self.db1.revid_of_upstream_version(version1),
+ self.assertEqual(
+ self.db1.revid_of_upstream_version(version1.upstream_version),
up_rh1[0])
- self.assertEqual(self.db1.revid_of_upstream_version(version3),
+ self.assertEqual(
+ self.db1.revid_of_upstream_version(version3.upstream_version),
up_rh1[1])
self.tree1.lock_read()
self.addCleanup(self.tree1.unlock)
=== modified file 'tests/test_upstream.py'
--- a/tests/test_upstream.py 2009-03-30 12:32:36 +0000
+++ b/tests/test_upstream.py 2009-07-15 18:36:36 +0000
@@ -109,15 +109,15 @@
self.tree = None
self.branch = None
self.package = None
- self.version = None
+ self.upstream_version = None
self.target_filename = None
- def provide(self, tree, branch, package, version, target_filename):
+ def provide(self, tree, branch, package, upstream_version, target_filename):
self.called_times += 1
self.tree = tree
self.branch = branch
self.package = package
- self.version = version
+ self.upstream_version = upstream_version
self.target_filename = target_filename
if self.find:
self.create_target(target_filename)
=== modified file 'upstream.py'
--- a/upstream.py 2009-03-30 12:32:36 +0000
+++ b/upstream.py 2009-07-15 18:36:36 +0000
@@ -277,7 +277,7 @@
def provide_with_pristine_tar(self, target_dir):
target_filename = os.path.join(target_dir, self._tarball_name())
return self._pristine_provider(self.tree, self.branch, self.package,
- self.version, target_filename)
+ self.version.upstream_version, target_filename)
def provide_with_get_orig_source(self, target_dir):
if self.larstiq:
More information about the Pkg-bazaar-commits
mailing list