Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mergebot/trunk/mergebot/RebranchActor.py

    r17 r30  
    3636
    3737        # Make sure the various urls we require do exist
    38         if not SvnOps.get_branch_info(self.local_url(), logfile):
    39             comment = 'Component %s does not exist in the repository.' \
    40                 % self.component
    41             return results, comment, False
    42         if not SvnOps.get_branch_info(self.local_url() + '/branches', logfile):
    43             comment = 'No directory in which to create branches for ' \
    44                 'component %s in the repository.' % self.component
    45             return results, comment, False
    46         if not SvnOps.get_branch_info(self.baseline_local_url(), logfile):
    47             comment = 'Version %s for component %s does not exist in the ' \
    48                 'repository.' % (self.version, self.component)
    49             return results, comment, False
     38        problems = self.check_required_directories()
     39        if problems:
     40            return results, problems, False
    5041
    5142        rev_info = SvnOps.get_branch_info(self.branch_local_url(), logfile)
     
    9788                "Rebranch internal error: Unable to recreate the branch.  %s" \
    9889                    % (instructioncomment, )),
    99             (lambda x: SvnOps.checkout(self.branch_local_url(), workingcopy, x),
    100                 "Rebranch internal error: Unable to get working copy.  %s" % \
    101                     (instructioncomment, )),
    10290        )
    10391        for cmd, error_comment in commanderrors:
     
    10896                results['mergebotstate'] = 'rebranchfailed'
    10997                return results, error_comment, False
     98
     99        # Check to see if there have been no commits on the branch.  If there
     100        # have been no commits, we know we don't need to merge anything.
     101        if startrev == endrev:
     102            ticket_message = "\n".join([
     103                "Rebranched from %s for %s." % (self.version,
     104                                                self.requestor),
     105                "There were no changes to commit to the branch since there "
     106                    "were no commits on the branch.",
     107                "You will need to update your working copy.",
     108            ])
     109            results['mergebotstate'] = 'branched'
     110            return results, ticket_message, True
     111
     112        retval = SvnOps.checkout(self.branch_local_url(), workingcopy, logfile)
     113        if retval:
     114            error_comment = \
     115                "Rebranch internal error: Unable to get working copy.  " + \
     116                instructioncomment
     117            if os.path.exists(workingcopy):
     118                shutil.rmtree(workingcopy)
     119            results['mergebotstate'] = 'rebranchfailed'
     120            return results, error_comment, False
    110121
    111122        # On success, we're in the same state as if we had just branched.
     
    135146                    "commit your work to the branch.",
    136147            ])
     148            success = False # the rebranch failed because there were conflicts
    137149        else: # No conflicts, do the commit.
    138150            mergemessage = "\n".join([
Note: See TracChangeset for help on using the changeset viewer.