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
1=== modified file 'cmds.py'
2--- cmds.py 2011-06-16 21:02:32 +0000
3+++ cmds.py 2011-06-21 20:57:30 +0000
4@@ -1234,7 +1234,7 @@
5 no_upstream_check_opt = Option('no-upstream-check',
6 help="Don't check whether patch has been merged upstream.")
7
8- takes_options = [directory_opt, "revision", no_upstream_check_opt]
9+ takes_options = [directory_opt, "revision", "change", no_upstream_check_opt]
10
11 def run(self, location, directory=".", revision=None, no_upstream_check=False):
12 from bzrlib.plugins.builddeb.dep3 import (
13@@ -1259,17 +1259,23 @@
14 else:
15 base_revid = graph.find_unique_lca(revision_id,
16 packaging_branch.last_revision())
17- interesting_revision_ids = graph.find_unique_ancestors(revision_id, [base_revid])
18+ interesting_revision_ids = graph.find_unique_ancestors(revision_id,
19+ [base_revid])
20 if len(interesting_revision_ids) == 0:
21 raise BzrCommandError("No unmerged revisions")
22 (bugs, authors, last_update) = gather_bugs_and_authors(branch.repository,
23 interesting_revision_ids)
24 config = branch.get_config()
25 description = config.get_user_option("description")
26- if description is None and len(interesting_revision_ids) == 1:
27- # if there's just one revision, use that revisions commits message
28- rev = branch.repository.get_revision(iter(interesting_revision_ids).next())
29- description = rev.message
30+ if description is None:
31+ # if there's just one revision in the mainline history, use
32+ # that revisions commits message
33+ lhs_history = graph.iter_lefthand_ancestry(revision_id, [base_revid])
34+ rev = branch.repository.get_revision(lhs_history.next())
35+ try:
36+ lhs_history.next()
37+ except StopIteration:
38+ description = rev.message
39 origin = describe_origin(branch, revision_id)
40 if packaging_tree is None:
41 packaging_tree = packaging_branch.basis_tree()
42
43=== modified file 'tests/blackbox/test_dep3.py'
44--- tests/blackbox/test_dep3.py 2011-05-08 10:47:40 +0000
45+++ tests/blackbox/test_dep3.py 2011-06-21 20:57:30 +0000
46@@ -51,7 +51,7 @@
47 self.feature_tree.commit(message="A message", timestamp=1304850124,
48 timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="therevid")
49 (out, err) = self.run_bzr("dep3-patch -d packaging feature")
50- self.assertEquals(out, "Description: A message\n"
51+ self.assertEqualDiff(out, "Description: A message\n"
52 "Origin: commit, revision id: therevid\n"
53 "Author: Jelmer <jelmer@debian.org>\n"
54 "Last-Update: 2011-05-08\n"
55@@ -102,3 +102,27 @@
56 self.feature_tree.commit(message="a message")
57 (out, err) = self.run_bzr("dep3-patch --no-upstream-check -d packaging feature")
58 self.assertNotContainsRe(out, "Applied-Upstream")
59+
60+ def test_range(self):
61+ # A range of revisions can be specified.
62+ self.build_tree_contents([("feature/foo", "bar\n")])
63+ self.feature_tree.add("foo")
64+ self.feature_tree.commit(message="Another message", timestamp=1304850124,
65+ timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="baserevid")
66+ self.build_tree_contents([("feature/foo", "bla\n")])
67+ self.feature_tree.commit(message="A message", timestamp=1304850124,
68+ timezone=0, authors=["Jelmer <jelmer@debian.org>"], rev_id="therevid")
69+ (out, err) = self.run_bzr("dep3-patch -c -1 -d packaging feature")
70+ self.assertEqualDiff(out, "Description: A message\n"
71+ "Origin: commit, revision id: therevid\n"
72+ "Author: Jelmer <jelmer@debian.org>\n"
73+ "Last-Update: 2011-05-08\n"
74+ "X-Bzr-Revision-Id: therevid\n"
75+ "\n"
76+ "=== modified file 'foo'\n"
77+ "--- old/foo\t2011-05-08 10:22:04 +0000\n"
78+ "+++ new/foo\t2011-05-08 10:22:04 +0000\n"
79+ "@@ -1,1 +1,1 @@\n"
80+ "-bar\n"
81+ "+bla\n"
82+ "\n")

Subscribers

People subscribed via source and target branches