Index: mergebot/trunk/utils/test.py
===================================================================
--- mergebot/trunk/utils/test.py	(revision 67)
+++ mergebot/trunk/utils/test.py	(revision 68)
@@ -295,4 +295,10 @@
         self.assertEqual(retval, 0, "svn prposet failed with error %s" % (retval))
 
+    def rm(self, filename):
+        retval = call(['svn', 'rm', filename],
+            cwd=self.get_workdir(),
+            stdout=logfile, stderr=logfile)
+        self.assertEqual(retval, 0, "svn rm failed with error %s" % (retval))
+
 
 class MergeBotTestEnabled(FunctionalTwillTestCaseSetup):
@@ -851,6 +857,57 @@
         #self._tester.go_to_mergebot()
         tc.find('Waiting')
-        self._tester.wait_for_empty_queue()
-        
+        self._tester.wait_for_empty_queue(60)
+
+        self.switch()
+        self.rm(basename + '-one')
+        self.rm(basename + '-two')
+        self.commit('Drop large files so later tests don\'t have to deal with them.')
+        self.cleanup()
+
+
+class MergeBotTestMergeDependencyCascade(FunctionalSvnTestCaseSetup):
+    def runTest(self):
+        """Merge two branches to trunk; make sure the second is cancelled when
+        the first hits merge conflicts.
+        """
+        ticket_one = self._tester.create_ticket(summary=self.__class__.__name__ + " one",
+            info={'component':'stuff', 'version':'trunk'})
+        ticket_two = self._tester.create_ticket(summary=self.__class__.__name__ + " two",
+            info={'component':'stuff', 'version':'trunk'})
+        basename = self.__class__.__name__
+
+        self.checkout()
+        # create a file on trunk to work with
+        # make it large enough to give us time to queue the second ticket
+        # before this one completes its merge
+        self.add_new_file(basename, 30*1024**2)
+        self.commit('Add a new file')
+        # branch the first ticket that we will have fail to merge due to
+        # conflicts.
+        self._tester.branch(ticket_one, 'stuff')
+        # modify the file on trunk
+        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
+        self.commit('Modify the file on trunk')
+        # and modify the file on the branch
+        self.switch(ticket_one)
+        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
+        self.commit('Modify the file on branch in conflicting manner')
+        # create a branch for the second ticket with a non-conflicting change
+        self._tester.branch(ticket_two, 'stuff')
+        self.switch(ticket_two)
+        self.add_new_file(basename + '-two')
+        self.commit('Add a new file')
+
+        # the stage is set.  Now we request the merge that will conflict,
+        # followed by the merge that won't, and wait for the merges to complete.
+        self._tester.queue_merge(ticket_one)
+        self._tester.queue_merge(ticket_two)
+        self._tester.wait_for_empty_queue(60)
+        # Then we verify that one had conflicts, and one was cancelled.        
+        self._tester.go_to_ticket(ticket_one)
+        tc.find('Found [0-9]+ conflicts? in attempt to merge ')
+        self._tester.go_to_ticket(ticket_two)
+        tc.notfind('Merged .* to .* for')
+        # and clean up the mess
         self.cleanup()
 
@@ -883,4 +940,5 @@
     suite.addTest(MergeBotTestBranchReuse())
     suite.addTest(MergeBotTestMergeDependency())
+    suite.addTest(MergeBotTestMergeDependencyCascade())
     return suite
 
