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
=== modified file 'cmds.py'
--- cmds.py 2009-08-24 17:33:44 +0000
+++ cmds.py 2009-09-11 12:14:13 +0000
@@ -356,6 +356,12 @@
356 branch_or_build_options_list, source)356 branch_or_build_options_list, source)
357 tree, branch, is_local = self._get_tree_and_branch(branch)357 tree, branch, is_local = self._get_tree_and_branch(branch)
358 tree, working_tree = self._get_build_tree(revision, tree, branch)358 tree, working_tree = self._get_build_tree(revision, tree, branch)
359
360 if len(tree.conflicts()) > 0:
361 raise BzrCommandError(
362 "There are conflicts in the working tree. "
363 "You must resolve these before building.")
364
359 tree.lock_read()365 tree.lock_read()
360 try:366 try:
361 config = debuild_config(tree, working_tree, no_user_config)367 config = debuild_config(tree, working_tree, no_user_config)
362368
=== modified file 'tests/blackbox/test_builddeb.py'
--- tests/blackbox/test_builddeb.py 2009-02-19 11:13:09 +0000
+++ tests/blackbox/test_builddeb.py 2009-09-11 12:14:13 +0000
@@ -78,6 +78,26 @@
78 tree.add([self.uncommited_file])78 tree.add([self.uncommited_file])
79 return tree79 return tree
8080
81 def build_tree_with_conflict(self):
82 tree = self.make_unpacked_source()
83 self.build_tree([self.commited_file, self.uncommited_file,
84 self.unadded_file])
85 tree.add([self.commited_file])
86 tree.commit("one", rev_id='revid1')
87 newtree = tree.bzrdir.sprout('newtree').open_workingtree()
88 tree.add([self.uncommited_file])
89 tree.commit("two", rev_id='revid2')
90
91 p = '%s/work/newtree/%s' % (self.test_base_dir, self.uncommited_file)
92 fh = open(p, 'w')
93 fh.write('** This is the conflicting line.')
94 fh.close()
95 newtree.add([self.uncommited_file])
96 newtree.commit("new-two", rev_id='revidn2')
97 conflicts = tree.merge_from_branch(newtree.branch)
98
99 return (conflicts, tree)
100
81 def test_builddeb_uses_working_tree(self):101 def test_builddeb_uses_working_tree(self):
82 self.build_really_simple_tree()102 self.build_really_simple_tree()
83 self.run_bzr("builddeb --no-user-conf --native --builder true "103 self.run_bzr("builddeb --no-user-conf --native --builder true "
@@ -85,6 +105,13 @@
85 self.assertInBuildDir([self.commited_file, self.uncommited_file])105 self.assertInBuildDir([self.commited_file, self.uncommited_file])
86 self.assertNotInBuildDir([self.unadded_file])106 self.assertNotInBuildDir([self.unadded_file])
87107
108 def test_builddeb_refuses_tree_with_conflicts(self):
109 (conflicts, tree) = self.build_tree_with_conflict()
110 self.assertTrue(conflicts > 0)
111 self.run_bzr_error(
112 ['There are conflicts in the working tree. You must resolve these before building.'],
113 "builddeb --no-user-conf --native --builder true --dont-purge")
114
88 def test_builddeb_uses_revision_when_told(self):115 def test_builddeb_uses_revision_when_told(self):
89 self.build_really_simple_tree()116 self.build_really_simple_tree()
90 self.run_bzr("builddeb --no-user-conf "117 self.run_bzr("builddeb --no-user-conf "

Subscribers

People subscribed via source and target branches