Changeset 21 for mergebot/branches/ticket-2
- Timestamp:
- Sep 19, 2009 2:27:30 PM (15 years ago)
- Location:
- mergebot/branches/ticket-2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
mergebot/branches/ticket-2/README.txt
r17 r21 3 3 $ svn co <url> mergebot-0.11 4 4 $ cd mergebot-0.11 5 $ ./rpm/makerpm5 $ python setup.py bdist_rpm 6 6 $ su -c "rpm --install dist/TracMergeBot*.noarch.rpm" 7 7 # Create the mergebot work area -
mergebot/branches/ticket-2/mergebot/Actor.py
r17 r21 1 """Base class for mergebot actors that do the various kinds of tasks 2 """ 1 3 import os 4 from mergebot import SvnOps 2 5 3 6 class Actor(object): 7 """Base class for mergebot actors""" 4 8 def __init__(self, work_dir, repo_url, repo_dir, ticket, component, 5 9 version, summary, requestor): … … 23 27 24 28 def logfilename(self): 29 """Returns the absolute path of the logfile for this ticket""" 25 30 return os.path.abspath(os.path.join(os.path.dirname(self.work_dir), 26 31 'ticket-%s.log' % self.ticket)) 27 32 28 33 def public_url(self): 34 """Returns the public URL for this component""" 29 35 return '%s/%s' % (self.repo_url, self.component) 30 36 … … 35 41 36 42 def local_url(self): 43 """Returns the local URL for this component""" 37 44 return 'file://%s/%s' % (self.repo_dir, self.component) 38 45 … … 48 55 49 56 def version_subdir(self): 57 """Returns the subdirectory name for the version""" 50 58 if self.version == 'trunk': 51 59 subdir = 'trunk' … … 58 66 return subdir 59 67 68 def check_required_directories(self): 69 """Make sure the various urls we require do exist""" 70 if not SvnOps.does_url_exist(self.local_url()): 71 return 'Component %s does not exist in the repository.' \ 72 % self.component 73 if not SvnOps.does_url_exist(self.local_url() + '/branches'): 74 return 'No directory in which to create branches for ' \ 75 'component %s in the repository.' % self.component 76 if not SvnOps.does_url_exist(self.baseline_local_url()): 77 return 'Version %s for component %s does not exist in the ' \ 78 'repository.' % (self.version, self.component) 79 return None 80 -
mergebot/branches/ticket-2/mergebot/BranchActor.py
r17 r21 2 2 """Module for creating new branches for tickets""" 3 3 4 import os5 4 import time 6 5 … … 20 19 21 20 # Make sure the various urls we require do exist 22 if not SvnOps.get_branch_info(self.local_url(), logfile): 23 comment = 'Component %s does not exist in the repository.' \ 24 % self.component 25 return results, comment, False 26 if not SvnOps.get_branch_info(self.local_url() + '/branches', logfile): 27 comment = 'No directory in which to create branches for component %s in the repository.' % self.component 28 return results, comment, False 29 if not SvnOps.get_branch_info(self.baseline_local_url(), logfile): 30 comment = 'Version %s for component %s does not exist in the repository.' % (self.version, self.component) 31 return results, comment, False 21 problems = self.check_required_directories() 22 if problems: 23 return results, problems, False 32 24 33 25 commit_header = 'Ticket #%s: %s' % (self.ticket, self.summary) … … 35 27 # Delete the branch if it already exists. This can happen if the branch 36 28 # was merged, but we're still working on it. 37 if SvnOps. get_branch_info(self.branch_local_url(), logfile):29 if SvnOps.does_url_exist(self.branch_local_url()): 38 30 # This branch already exists. 39 31 commit_message = "\n".join([commit_header, … … 63 55 'Created branch from %s for %s.' % (self.version, self.requestor), 64 56 '', 65 'Browse branch [source:%s/branches/ticket-%s source code] and [log:%s/branches/ticket-%s commit log].' % 57 'Browse branch [source:%s/branches/ticket-%s source code] and ' \ 58 '[log:%s/branches/ticket-%s commit log].' % 66 59 (self.component, self.ticket, self.component, self.ticket), 67 60 '', -
mergebot/branches/ticket-2/mergebot/CheckMergeActor.py
r17 r21 28 28 29 29 # Make sure the various urls we require do exist 30 if not SvnOps.get_branch_info(self.local_url(), logfile): 31 comment = 'Component %s does not exist in the repository.' \ 32 % self.component 33 return results, comment, False 34 if not SvnOps.get_branch_info(self.local_url() + '/branches', logfile): 35 comment = 'No directory in which to create branches for ' \ 36 'component %s in the repository.' % self.component 37 return results, comment, False 38 if not SvnOps.get_branch_info(self.baseline_local_url(), logfile): 39 comment = 'Version %s for component %s does not exist in the ' \ 40 'repository.' % (self.version, self.component) 41 return results, comment, False 30 problems = self.check_required_directories() 31 if problems: 32 return results, problems, False 42 33 43 34 branch_info = SvnOps.get_branch_info(self.branch_local_url(), logfile) -
mergebot/branches/ticket-2/mergebot/MergeActor.py
r17 r21 26 26 27 27 # Make sure the various urls we require do exist 28 if not SvnOps.get_branch_info(self.local_url(), logfile): 29 comment = 'Component %s does not exist in the repository.' \ 30 % self.component 31 return results, comment, False 32 if not SvnOps.get_branch_info(self.local_url() + '/branches', logfile): 33 comment = 'No directory in which to create branches for component %s in the repository.' % self.component 34 return results, comment, False 35 if not SvnOps.get_branch_info(self.baseline_local_url(), logfile): 36 comment = 'Version %s for component %s does not exist in the repository.' % (self.version, self.component) 37 return results, comment, False 28 problems = self.check_required_directories() 29 if problems: 30 return results, problems, False 38 31 39 32 rev_info = SvnOps.get_branch_info(self.branch_local_url(), logfile) 40 33 if not rev_info: 41 comment = 'Branch for ticket %s does not exist in the repository.' % (self.ticket) 34 comment = 'Branch for ticket %s does not exist in the repository.' \ 35 % (self.ticket) 42 36 return results, comment, False 43 37 startrev, endrev = rev_info -
mergebot/branches/ticket-2/mergebot/RebranchActor.py
r17 r21 36 36 37 37 # 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 50 41 51 42 rev_info = SvnOps.get_branch_info(self.branch_local_url(), logfile) -
mergebot/branches/ticket-2/mergebot/SvnOps.py
r16 r21 8 8 import time 9 9 import re 10 import subprocess 10 11 11 12 def shell_quote(string): … … 24 25 """Given a log entry split out of svn log, return its revision number""" 25 26 return int(logentry.split()[0][1:]) 27 28 def does_url_exist(url): 29 """Given a subversion url return true if it exists, false otherwise.""" 30 return not subprocess.call(['svn', 'ls', '--depth', 'empty', 31 '--non-interactive', url], 32 stdout=open('/dev/null', 'w'), 33 stderr=open('/dev/null', 'w')) 26 34 27 35 def get_branch_info(url, logfile):
Note: See TracChangeset
for help on using the changeset viewer.