Merge lp:~jelmer/bzr-builddeb/dep3-fixes into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 649
Merged at revision: 648
Proposed branch: lp:~jelmer/bzr-builddeb/dep3-fixes
Merge into: lp:bzr-builddeb
Diff against target: 134 lines (+58/-48)
3 files modified
cmds.py (+47/-47)
debian/changelog (+3/-1)
tests/blackbox/test_dep3.py (+8/-0)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/dep3-fixes
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+83481@code.launchpad.net

Description of the change

Some fixes for 'bzr dep3-patch':

 * Allow open ended revision ranges (-r-4..)
 * Support extracting patches from remote repositories

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

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-11-10 18:44:05 +0000
3+++ cmds.py 2011-11-26 15:11:23 +0000
4@@ -1301,51 +1301,51 @@
5 )
6 packaging_tree, packaging_branch = BzrDir.open_containing_tree_or_branch(
7 directory)[:2]
8+ self.add_cleanup(packaging_branch.lock_read().unlock)
9 tree, branch = BzrDir.open_containing_tree_or_branch(location)[:2]
10- branch.lock_read()
11- try:
12- if revision is not None and len(revision) >= 1:
13- revision_id = revision[-1].as_revision_id(branch)
14- else:
15- revision_id = branch.last_revision()
16- graph = branch.repository.get_graph(packaging_branch.repository)
17- if revision is not None and len(revision) == 2:
18- base_revid = revision[0].as_revision_id(branch)
19- else:
20- base_revid = graph.find_unique_lca(revision_id,
21- packaging_branch.last_revision())
22- interesting_revision_ids = graph.find_unique_ancestors(revision_id,
23- [base_revid])
24- if len(interesting_revision_ids) == 0:
25- raise BzrCommandError("No unmerged revisions")
26- (bugs, authors, last_update) = gather_bugs_and_authors(branch.repository,
27- interesting_revision_ids)
28- config = branch.get_config()
29- description = config.get_user_option("description")
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- builddeb_config = debuild_config(packaging_tree, True)
43- if not no_upstream_check and builddeb_config.upstream_branch:
44- upstream_branch = Branch.open(builddeb_config.upstream_branch)
45- applied_upstream = determine_applied_upstream(upstream_branch, branch,
46- revision_id)
47- forwarded = determine_forwarded(upstream_branch, branch, revision_id)
48- else:
49- applied_upstream = None
50- forwarded = None
51- write_dep3_patch(self.outf, branch, base_revid,
52- revision_id, bugs=bugs, authors=authors, origin=origin,
53- forwarded=forwarded, applied_upstream=applied_upstream,
54- description=description, last_update=last_update)
55- finally:
56- branch.unlock()
57+ self.add_cleanup(branch.lock_read().unlock)
58+ if revision is not None and len(revision) >= 1:
59+ revision_id = revision[-1].as_revision_id(branch)
60+ else:
61+ revision_id = None
62+ if revision_id is None:
63+ revision_id = branch.last_revision()
64+ graph = branch.repository.get_graph(packaging_branch.repository)
65+ if revision is not None and len(revision) == 2:
66+ base_revid = revision[0].as_revision_id(branch)
67+ else:
68+ base_revid = graph.find_unique_lca(revision_id,
69+ packaging_branch.last_revision())
70+ interesting_revision_ids = graph.find_unique_ancestors(revision_id,
71+ [base_revid])
72+ if len(interesting_revision_ids) == 0:
73+ raise BzrCommandError("No unmerged revisions")
74+ (bugs, authors, last_update) = gather_bugs_and_authors(branch.repository,
75+ interesting_revision_ids)
76+ config = branch.get_config()
77+ description = config.get_user_option("description")
78+ if description is None:
79+ # if there's just one revision in the mainline history, use
80+ # that revisions commits message
81+ lhs_history = graph.iter_lefthand_ancestry(revision_id, [base_revid])
82+ rev = branch.repository.get_revision(lhs_history.next())
83+ try:
84+ lhs_history.next()
85+ except StopIteration:
86+ description = rev.message
87+ origin = describe_origin(branch, revision_id)
88+ if packaging_tree is None:
89+ packaging_tree = packaging_branch.basis_tree()
90+ builddeb_config = debuild_config(packaging_tree, True)
91+ if not no_upstream_check and builddeb_config.upstream_branch:
92+ upstream_branch = Branch.open(builddeb_config.upstream_branch)
93+ applied_upstream = determine_applied_upstream(upstream_branch, branch,
94+ revision_id)
95+ forwarded = determine_forwarded(upstream_branch, branch, revision_id)
96+ else:
97+ applied_upstream = None
98+ forwarded = None
99+ write_dep3_patch(self.outf, branch, base_revid,
100+ revision_id, bugs=bugs, authors=authors, origin=origin,
101+ forwarded=forwarded, applied_upstream=applied_upstream,
102+ description=description, last_update=last_update)
103
104=== modified file 'debian/changelog'
105--- debian/changelog 2011-11-22 14:05:25 +0000
106+++ debian/changelog 2011-11-26 15:11:23 +0000
107@@ -23,8 +23,10 @@
108 * Support --revision argument to merge-package. LP: #888590
109 * By default, don't override the commit message from debian/changelog
110 unless 'commit-message-from-changelog' is explicitly set to True. LP: #812749
111+ * Support running dep3-patch against remote repositories, and with
112+ open-ended revision ranges. LP: #893608
113
114- -- Jelmer Vernooij <jelmer@debian.org> Tue, 22 Nov 2011 12:04:47 +0100
115+ -- Jelmer Vernooij <jelmer@debian.org> Sat, 26 Nov 2011 16:01:16 +0100
116
117 bzr-builddeb (2.7.9) unstable; urgency=low
118
119
120=== modified file 'tests/blackbox/test_dep3.py'
121--- tests/blackbox/test_dep3.py 2011-06-21 20:55:13 +0000
122+++ tests/blackbox/test_dep3.py 2011-11-26 15:11:23 +0000
123@@ -126,3 +126,11 @@
124 "-bar\n"
125 "+bla\n"
126 "\n")
127+
128+ def test_open_ended_range(self):
129+ # If there is a single revision the commit message from
130+ # that revision will be used.
131+ self.feature_tree.commit(message="A message", timestamp=1304850124,
132+ timezone=0, authors=["Jelmer <jelmer@debian.org>"])
133+ (out, err) = self.run_bzr("dep3-patch -d packaging feature -r-2..")
134+ self.assertContainsRe(out, "Description: A message\n")

Subscribers

People subscribed via source and target branches