Merge lp:~jelmer/bzr-builddeb/allow-merge-mode-bzr-builddeb into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 479
Proposed branch: lp:~jelmer/bzr-builddeb/allow-merge-mode-bzr-builddeb
Merge into: lp:bzr-builddeb
Diff against target: 53 lines (+18/-3)
2 files modified
cmds.py (+6/-3)
util.py (+12/-0)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/allow-merge-mode-bzr-builddeb
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+27828@code.launchpad.net

Description of the change

This fixes the automatic detection of merge mode if a .bzr-builddeb directory is present.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmds.py'
2--- cmds.py 2010-05-28 20:49:11 +0000
3+++ cmds.py 2010-06-17 12:55:40 +0000
4@@ -99,6 +99,7 @@
5 open_file,
6 open_file_via_transport,
7 tarball_name,
8+ tree_contains_upstream_source,
9 )
10
11 dont_purge_opt = Option('dont-purge',
12@@ -356,7 +357,7 @@
13 use_existing = True
14 merge, native, split = self._build_type(config, merge, native, split)
15 if (not merge and not native and not split and
16- tree.inventory.root.children.keys() == ["debian"]):
17+ not tree_contains_upstream_source(tree)):
18 # Default to merge mode if there's only a debian/ directory
19 merge = True
20 (changelog, larstiq) = find_changelog(tree, merge)
21@@ -380,8 +381,10 @@
22 upstream_branch, upstream_revision = self._get_upstream_branch(
23 merge, export_upstream, export_upstream_revision, config,
24 changelog.version)
25- upstream_sources.append(UpstreamBranchSource(upstream_branch,
26- {changelog.version.upstream_version: upstream_revision}))
27+ if upstream_branch is not None:
28+ upstream_sources.append(UpstreamBranchSource(
29+ upstream_branch, {
30+ changelog.version.upstream_version: upstream_revision}))
31 elif not native and config.upstream_branch:
32 upstream_branch = Branch.open(config.upstream_branch)
33 upstream_sources.append(UpstreamBranchSource(upstream_branch))
34
35=== modified file 'util.py'
36--- util.py 2010-05-23 15:29:38 +0000
37+++ util.py 2010-06-17 12:55:40 +0000
38@@ -590,3 +590,15 @@
39 if block.distributions.split(" ")[0] in match_targets:
40 return block.version
41 raise NoPreviousUpload(current_target)
42+
43+
44+def tree_contains_upstream_source(tree):
45+ """Guess if the specified tree contains the upstream source.
46+
47+ :param tree: A RevisionTree.
48+ :return: Boolean indicating whether or not the tree contains the upstream
49+ source
50+ """
51+ present_files = set(tree.inventory.root.children.keys())
52+ packaging_files = frozenset(["debian", ".bzr-builddeb"])
53+ return (len(present_files - packaging_files) > 0)

Subscribers

People subscribed via source and target branches