Changeset 57 for mergebot/trunk/utils


Ignore:
Timestamp:
Feb 23, 2010 8:23:29 PM (15 years ago)
Author:
retracile
Message:

Mergebot: add a testcase for one of the rename conflict cases and fix the svn 1.6 code to handle it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/utils/test.py

    r56 r57  
    102102            raise Exception('svn ls failed with exit code %s' % retval)
    103103
    104     def rebranch(self, ticket_id, component, timeout=15):
     104    def _rebranch(self, ticket_id, component, search, timeout=15):
    105105        """timeout is in seconds."""
    106106        self.go_to_mergebot()
     
    112112        tc.find('CheckMerge')
    113113        self.go_to_ticket(ticket_id)
    114         tc.find('(Rebranched from .* for .*|There were conflicts on rebranching)')
     114        tc.find(search)
    115115        retval = call(['svn', 'ls', self.repo_url + '/' + component + '/branches/ticket-%s' % ticket_id],
    116116                    stdout=logfile, stderr=logfile)
    117117        if retval:
    118118            raise Exception('svn ls failed with exit code %s' % retval)
     119
     120    def rebranch(self, ticket_id, component, timeout=15):
     121        self._rebranch(ticket_id, component, 'Rebranched from .* for .*', timeout)
     122
     123    def rebranch_conflict(self, ticket_id, component, timeout=15):
     124        self._rebranch(ticket_id, component, 'There were conflicts on rebranching', timeout)
    119125
    120126    def merge(self, ticket_id, component, timeout=5):
     
    233239        self.assertEqual(retval, 0, "svn commit failed with error %s" % (retval))
    234240
     241    def mv(self, oldname, newname):
     242        retval = call(['svn', 'mv', oldname, newname],
     243            cwd=self.get_workdir(),
     244            stdout=logfile, stderr=logfile)
     245        self.assertEqual(retval, 0, "svn mv failed with error %s" % (retval))
     246
    235247
    236248class MergeBotTestEnabled(FunctionalTwillTestCaseSetup):
     
    351363        self.commit('Modify the file on branch')
    352364
    353         self._tester.rebranch(ticket_id, 'stuff')
     365        # rebranch, make sure it shows a conflict
     366        self._tester.rebranch_conflict(ticket_id, 'stuff')
     367
     368
     369class MergeBotTestRebranchWithBranchRenameConflict(FunctionalSvnTestCaseSetup):
     370    def runTest(self):
     371        """Verify that the 'rebranch' button works when a file renamed on the branch was modified on trunk"""
     372        ticket_id = self._tester.create_ticket(summary=self.__class__.__name__,
     373            info={'component':'stuff', 'version':'trunk'})
     374        basename = self.__class__.__name__
     375
     376        # create a file in which to have conflicts
     377        self.checkout()
     378        self.add_new_file(basename)
     379        self.commit('Add a new file on trunk')
     380
     381        # create the branch
     382        self._tester.branch(ticket_id, 'stuff')
     383
     384        # modify the file on trunk
     385        open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence())
     386        self.commit('Modify the file on trunk')
     387
     388        # rename the file on the branch
     389        self.switch(ticket_id)
     390        self.mv(basename, basename + '-renamed')
     391        self.commit('Rename the file on branch')
     392
     393        self._tester.rebranch_conflict(ticket_id, 'stuff')
    354394
    355395
     
    395435    suite.addTest(MergeBotTestRebranchWithChangeAndTrunkChange())
    396436    suite.addTest(MergeBotTestRebranchWithConflict())
     437    suite.addTest(MergeBotTestRebranchWithBranchRenameConflict())
    397438    suite.addTest(MergeBotTestSingleUseCase())
    398439    return suite
Note: See TracChangeset for help on using the changeset viewer.