Merge lp:~jelmer/bzr-builddeb/dep3-patch-c into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: no longer in the source branch.
Merged at revision: 575
Proposed branch: lp:~jelmer/bzr-builddeb/dep3-patch-c
Merge into: lp:bzr-builddeb
Diff against target: 82 lines (+37/-7)
2 files modified
cmds.py (+12/-6)
tests/blackbox/test_dep3.py (+25/-1)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/dep3-patch-c
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+65412@code.launchpad.net

Description of the change

Add a -c option to 'bzr dep3-patch'.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve
lp:~jelmer/bzr-builddeb/dep3-patch-c updated
575. By Jelmer Vernooij

Merge support for -c argument to 'bzr dep3-patch'.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmds.py'
--- cmds.py 2011-06-16 21:02:32 +0000
+++ cmds.py 2011-06-21 20:57:30 +0000
@@ -1234,7 +1234,7 @@
1234 no_upstream_check_opt = Option('no-upstream-check',1234 no_upstream_check_opt = Option('no-upstream-check',
1235 help="Don't check whether patch has been merged upstream.")1235 help="Don't check whether patch has been merged upstream.")
12361236
1237 takes_options = [directory_opt, "revision", no_upstream_check_opt]1237 takes_options = [directory_opt, "revision", "change", no_upstream_check_opt]
12381238
1239 def run(self, location, directory=".", revision=None, no_upstream_check=False):1239 def run(self, location, directory=".", revision=None, no_upstream_check=False):
1240 from bzrlib.plugins.builddeb.dep3 import (1240 from bzrlib.plugins.builddeb.dep3 import (
@@ -1259,17 +1259,23 @@
1259 else:1259 else:
1260 base_revid = graph.find_unique_lca(revision_id,1260 base_revid = graph.find_unique_lca(revision_id,
1261 packaging_branch.last_revision())1261 packaging_branch.last_revision())
1262 interesting_revision_ids = graph.find_unique_ancestors(revision_id, [base_revid])1262 interesting_revision_ids = graph.find_unique_ancestors(revision_id,
1263 [base_revid])
1263 if len(interesting_revision_ids) == 0:1264 if len(interesting_revision_ids) == 0:
1264 raise BzrCommandError("No unmerged revisions")1265 raise BzrCommandError("No unmerged revisions")
1265 (bugs, authors, last_update) = gather_bugs_and_authors(branch.repository,1266 (bugs, authors, last_update) = gather_bugs_and_authors(branch.repository,
1266 interesting_revision_ids)1267 interesting_revision_ids)
1267 config = branch.get_config()1268 config = branch.get_config()
1268 description = config.get_user_option("description")1269 description = config.get_user_option("description")
1269 if description is None and len(interesting_revision_ids) == 1:1270 if description is None:
1270 # if there's just one revision, use that revisions commits message1271 # if there's just one revision in the mainline history, use
1271 rev = branch.repository.get_revision(iter(interesting_revision_ids).next())1272 # that revisions commits message
1272 description = rev.message1273 lhs_history = graph.iter_lefthand_ancestry(revision_id, [base_revid])
1274 rev = branch.repository.get_revision(lhs_history.next())
1275 try:
1276 lhs_history.next()
1277 except StopIteration:
1278 description = rev.message
1273 origin = describe_origin(branch, revision_id)1279 origin = describe_origin(branch, revision_id)
1274 if packaging_tree is None:1280 if packaging_tree is None:
1275 packaging_tree = packaging_branch.basis_tree()1281 packaging_tree = packaging_branch.basis_tree()
12761282
=== modified file 'tests/blackbox/test_dep3.py'
--- tests/blackbox/test_dep3.py 2011-05-08 10:47:40 +0000
+++ tests/blackbox/test_dep3.py 2011-06-21 20:57:30 +0000
@@ -51,7 +51,7 @@
51 self.feature_tree.commit(message="A message", timestamp=1304850124,51 self.feature_tree.commit(message="A message", timestamp=1304850124,
52 timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="therevid")52 timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="therevid")
53 (out, err) = self.run_bzr("dep3-patch -d packaging feature")53 (out, err) = self.run_bzr("dep3-patch -d packaging feature")
54 self.assertEquals(out, "Description: A message\n"54 self.assertEqualDiff(out, "Description: A message\n"
55 "Origin: commit, revision id: therevid\n"55 "Origin: commit, revision id: therevid\n"
56 "Author: Jelmer <jelmer@debian.org>\n"56 "Author: Jelmer <jelmer@debian.org>\n"
57 "Last-Update: 2011-05-08\n"57 "Last-Update: 2011-05-08\n"
@@ -102,3 +102,27 @@
102 self.feature_tree.commit(message="a message")102 self.feature_tree.commit(message="a message")
103 (out, err) = self.run_bzr("dep3-patch --no-upstream-check -d packaging feature")103 (out, err) = self.run_bzr("dep3-patch --no-upstream-check -d packaging feature")
104 self.assertNotContainsRe(out, "Applied-Upstream")104 self.assertNotContainsRe(out, "Applied-Upstream")
105
106 def test_range(self):
107 # A range of revisions can be specified.
108 self.build_tree_contents([("feature/foo", "bar\n")])
109 self.feature_tree.add("foo")
110 self.feature_tree.commit(message="Another message", timestamp=1304850124,
111 timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="baserevid")
112 self.build_tree_contents([("feature/foo", "bla\n")])
113 self.feature_tree.commit(message="A message", timestamp=1304850124,
114 timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="therevid")
115 (out, err) = self.run_bzr("dep3-patch -c -1 -d packaging feature")
116 self.assertEqualDiff(out, "Description: A message\n"
117 "Origin: commit, revision id: therevid\n"
118 "Author: Jelmer <jelmer@debian.org>\n"
119 "Last-Update: 2011-05-08\n"
120 "X-Bzr-Revision-Id: therevid\n"
121 "\n"
122 "=== modified file 'foo'\n"
123 "--- old/foo\t2011-05-08 10:22:04 +0000\n"
124 "+++ new/foo\t2011-05-08 10:22:04 +0000\n"
125 "@@ -1,1 +1,1 @@\n"
126 "-bar\n"
127 "+bla\n"
128 "\n")

Subscribers

People subscribed via source and target branches