Merge lp:~jelmer/bzr-builddeb/get-source-format into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 583
Merged at revision: 582
Proposed branch: lp:~jelmer/bzr-builddeb/get-source-format
Merge into: lp:bzr-builddeb
Diff against target: 34 lines (+10/-2)
2 files modified
tests/test_util.py (+6/-0)
util.py (+4/-2)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/get-source-format
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+68090@code.launchpad.net

Description of the change

Fix the use of get_source_format when debian/source/format is unversioned.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

On Fri, 15 Jul 2011 14:20:03 -0000, Jelmer Vernooij <email address hidden> wrote:
> if not tree.has_filename("debian/source/format"):
> return FORMAT_1_0
> - return tree.get_file_text(tree.path2id("debian/source/format")).strip()
> + text = tree.get_file_text(tree.path2id("debian/source/format"),
> + "debian/source/format")
> + return text.strip()

Looks good, but perhaps we could make all those magic strings one
variable?

Thanks,

James

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Fri, 2011-07-15 at 14:46 +0000, James Westby wrote:
> On Fri, 15 Jul 2011 14:20:03 -0000, Jelmer Vernooij <email address hidden> wrote:
> > if not tree.has_filename("debian/source/format"):
> > return FORMAT_1_0
> > - return tree.get_file_text(tree.path2id("debian/source/format")).strip()
> > + text = tree.get_file_text(tree.path2id("debian/source/format"),
> > + "debian/source/format")
> > + return text.strip()
>
> Looks good, but perhaps we could make all those magic strings one
> variable?
That seems reasonable - updated in the current branch.

Cheers,

Jelmer

583. By Jelmer Vernooij

factor out variable.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_util.py'
2--- tests/test_util.py 2011-06-28 08:41:44 +0000
3+++ tests/test_util.py 2011-07-15 15:07:18 +0000
4@@ -785,6 +785,12 @@
5 tree.add(["debian", "debian/source", "debian/source/format"])
6 self.assertEquals("3.0 (quilt)", get_source_format(tree))
7
8+ def test_source_format_file_unversioned(self):
9+ tree = self.make_branch_and_tree('.')
10+ self.build_tree_contents([("debian/",), ("debian/source/",),
11+ ("debian/source/format", "3.0 (quilt)")])
12+ self.assertEquals("3.0 (quilt)", get_source_format(tree))
13+
14
15 class GuessBuildTypeTests(TestCaseWithTransport):
16 """Tests for guess_build_type."""
17
18=== modified file 'util.py'
19--- util.py 2011-06-28 08:41:44 +0000
20+++ util.py 2011-07-15 15:07:18 +0000
21@@ -639,9 +639,11 @@
22 :param path: Path to the package
23 :return: String with package format
24 """
25- if not tree.has_filename("debian/source/format"):
26+ filename = "debian/source/format"
27+ if not tree.has_filename(filename):
28 return FORMAT_1_0
29- return tree.get_file_text(tree.path2id("debian/source/format")).strip()
30+ text = tree.get_file_text(tree.path2id(filename), filename)
31+ return text.strip()
32
33
34 FORMAT_1_0 = "1.0"

Subscribers

People subscribed via source and target branches