Merge lp:~al-maisan/bzr-builddeb/refuse-building-trees-with-conflicts into lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/bzr-builddeb/refuse-building-trees-with-conflicts
Merge into: lp:~bzr-builddeb-hackers/bzr-builddeb/trunk-old
Diff against target: None lines
To merge this branch: bzr merge lp:~al-maisan/bzr-builddeb/refuse-building-trees-with-conflicts
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+11599@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

This branch adds a "refuse to build in a tree with conflicts" check. Please have a look and let me know what you think.

Thanks!

372. By Muharem Hrnjadovic

Cosmetic fix.

Revision history for this message
James Westby (james-w) wrote :

Looks good, thanks.

James

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 2009-08-24 17:33:44 +0000
3+++ cmds.py 2009-09-11 12:14:13 +0000
4@@ -356,6 +356,12 @@
5 branch_or_build_options_list, source)
6 tree, branch, is_local = self._get_tree_and_branch(branch)
7 tree, working_tree = self._get_build_tree(revision, tree, branch)
8+
9+ if len(tree.conflicts()) > 0:
10+ raise BzrCommandError(
11+ "There are conflicts in the working tree. "
12+ "You must resolve these before building.")
13+
14 tree.lock_read()
15 try:
16 config = debuild_config(tree, working_tree, no_user_config)
17
18=== modified file 'tests/blackbox/test_builddeb.py'
19--- tests/blackbox/test_builddeb.py 2009-02-19 11:13:09 +0000
20+++ tests/blackbox/test_builddeb.py 2009-09-11 12:14:13 +0000
21@@ -78,6 +78,26 @@
22 tree.add([self.uncommited_file])
23 return tree
24
25+ def build_tree_with_conflict(self):
26+ tree = self.make_unpacked_source()
27+ self.build_tree([self.commited_file, self.uncommited_file,
28+ self.unadded_file])
29+ tree.add([self.commited_file])
30+ tree.commit("one", rev_id='revid1')
31+ newtree = tree.bzrdir.sprout('newtree').open_workingtree()
32+ tree.add([self.uncommited_file])
33+ tree.commit("two", rev_id='revid2')
34+
35+ p = '%s/work/newtree/%s' % (self.test_base_dir, self.uncommited_file)
36+ fh = open(p, 'w')
37+ fh.write('** This is the conflicting line.')
38+ fh.close()
39+ newtree.add([self.uncommited_file])
40+ newtree.commit("new-two", rev_id='revidn2')
41+ conflicts = tree.merge_from_branch(newtree.branch)
42+
43+ return (conflicts, tree)
44+
45 def test_builddeb_uses_working_tree(self):
46 self.build_really_simple_tree()
47 self.run_bzr("builddeb --no-user-conf --native --builder true "
48@@ -85,6 +105,13 @@
49 self.assertInBuildDir([self.commited_file, self.uncommited_file])
50 self.assertNotInBuildDir([self.unadded_file])
51
52+ def test_builddeb_refuses_tree_with_conflicts(self):
53+ (conflicts, tree) = self.build_tree_with_conflict()
54+ self.assertTrue(conflicts > 0)
55+ self.run_bzr_error(
56+ ['There are conflicts in the working tree. You must resolve these before building.'],
57+ "builddeb --no-user-conf --native --builder true --dont-purge")
58+
59 def test_builddeb_uses_revision_when_told(self):
60 self.build_really_simple_tree()
61 self.run_bzr("builddeb --no-user-conf "

Subscribers

People subscribed via source and target branches