def process_request(self, req): req.perm.assert_permission('CHANGESET_VIEW') rev = req.args.get('rev') repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) authzperm.assert_permission_for_changeset(rev) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.changeset(rev)) chgset = repos.get_changeset(rev) req.check_modified(chgset.date, diff_options[0] + ''.join(diff_options[1])) format = req.args.get('format') if format == 'diff': self._render_diff(req, repos, chgset, diff_options) return elif format == 'zip': self._render_zip(req, repos, chgset) return self._render_html(req, repos, chgset, diff_options) add_link(req, 'alternate', '?format=diff', 'Unified Diff', 'text/plain', 'diff') add_link(req, 'alternate', '?format=zip', 'Zip Archive', 'application/zip', 'zip') add_stylesheet(req, 'common/css/changeset.css') add_stylesheet(req, 'common/css/diff.css') add_stylesheet(req, 'common/css/code.css') return 'changeset.cs', None
def getTestCases(self, component, req ): repository = self.getRepository( component, req ) authzperm = SubversionAuthorizer( component.env, req.authname) authzperm.assert_permission_for_changeset(repository.youngest_rev) node = repository.get_node( self.getTestCasePath( component, req ), repository.youngest_rev ) entries = node.get_entries() testcases = {} #let's create the list of testcases... for entry in entries : match = re.match('testtemplates.xml', entry.get_name() ) #we want to parse testcases not the testtemplate file... if not match: content = entry.get_content().read() testcase = TestCase( entry.get_name(), str(content), component ) testcases[ testcase.getId().encode('ascii', 'ignore').strip() ] = testcase #first let's do some validation on the testcases... components = self.getComponents( component, req ) currentTestcase = None try: for key, value in testcases.iteritems(): currentTestcase = value #incase we do toss an exception I'll want some information from this testcase components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project except Exception, ex: req.hdf['testcase.run.errormessage'] = "The component :" + currentTestcase.getComponent() + " in the testcase : " + currentTestcase.getId() + " does not exist in the trac project " component.env.log.debug( "Error validating testcases " + repr(ex) ) return None
def process_request(self, req, db=None): req.perm.assert_permission('CHANGESET_VIEW') if not db: db = self.env.get_db_cnx() # Fetch the standard ticket fields cursor = db.cursor() ticket_id = req.args.get('ticket_id') req.hdf['ticket_id'] = ticket_id repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.setchangeset(ticket_id)) ticket = Ticket(self.env, ticket_id) ticket.setchangesets = self.get_setchangesets(ticket_id,db) ticket.values['setchangesets'] = ticket.setchangesets ticket.values['changesets'] = "" for changeset in ticket.setchangesets: ticket.values['changesets'] += str(changeset) setchangesets = ticket.setchangesets req.hdf['ticket'] = ticket req.hdf['dbWarning'] = False # get the list of changesets for the ticket_id # then loop through and get the actual changesets like the following line chgset = [] self.log.debug('PublishRevert: %s', ticket['ticketaction']) for rev in setchangesets: authzperm.assert_permission_for_changeset(rev) changeset = repos.get_changeset(rev) chgset.append(changeset) format = req.args.get('format') self._render_html(req, ticket, repos, chgset, diff_options) return 'setchangeset.cs', None
def process_request(self, req, db=None): req.perm.assert_permission('CHANGESET_VIEW') if not db: db = self.env.get_db_cnx() # Fetch the standard ticket fields cursor = db.cursor() ticket_id = req.args.get('ticket_id') req.hdf['ticket_id'] = ticket_id repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.setchangeset(ticket_id)) ticket = Ticket(self.env, ticket_id) ticket.setchangesets = self.get_setchangesets(ticket_id, db) ticket.values['setchangesets'] = ticket.setchangesets ticket.values['changesets'] = "" for changeset in ticket.setchangesets: ticket.values['changesets'] += str(changeset) setchangesets = ticket.setchangesets req.hdf['ticket'] = ticket req.hdf['dbWarning'] = False # get the list of changesets for the ticket_id # then loop through and get the actual changesets like the following line chgset = [] self.log.debug('PublishRevert: %s', ticket['ticketaction']) for rev in setchangesets: authzperm.assert_permission_for_changeset(rev) changeset = repos.get_changeset(rev) chgset.append(changeset) format = req.args.get('format') self._render_html(req, ticket, repos, chgset, diff_options) return 'setchangeset.cs', None
def process_request(self, req, db=None): req.perm.assert_permission('TRAC_ADMIN') if not db: self.db = self.env.get_db_cnx() ticket_id = req.args.get('ticket_id') req.hdf['ticket_id'] = ticket_id req.hdf['message'] = '' repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.svnpublish(ticket_id)) ticket = Ticket(self.env, ticket_id) chgset = [] if (ticket['ticketaction'] == "ClonePublish"): from publishrevert.setchangeset import SetChangesetModule setchangeset = SetChangesetModule(self.env) setchangesets = setchangeset.get_setchangesets(ticket_id) # get the list of changesets for the ticket_id # then loop through and get the actual changesets like the following line for rev in setchangesets: authzperm.assert_permission_for_changeset(rev) changeset = repos.get_changeset(rev) # now loop through the files in changeset to get all the paths # and for each path, find the current test/prod revision number and save that info chgset.append(changeset) format = req.args.get('format') self._render_html(req, ticket, repos, chgset, diff_options) req.hdf['setchangesets'] = setchangesets ticket['ticketaction'] = 'CloneTest' ticket.save_changes(req.authname, 'published to clone', 0, db) req.hdf['message'] += 'Successfully Published All Files' req.hdf['ticket'] = ticket.values else: req.hdf['error'] = 'Error: not in correct state to publish' return 'setchangeset.cs', None
def process_request(self, req, db=None): req.perm.assert_permission('TRAC_ADMIN') if not db: self.db = self.env.get_db_cnx() ticket_id = req.args.get('ticket_id') req.hdf['ticket_id'] = ticket_id req.hdf['message'] = '' repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.svnpublish(ticket_id)) ticket = Ticket(self.env, ticket_id) chgset = [] if(ticket['ticketaction'] == "ClonePublish"): from publishrevert.setchangeset import SetChangesetModule setchangeset = SetChangesetModule(self.env) setchangesets = setchangeset.get_setchangesets(ticket_id) # get the list of changesets for the ticket_id # then loop through and get the actual changesets like the following line for rev in setchangesets: authzperm.assert_permission_for_changeset(rev) changeset = repos.get_changeset(rev) # now loop through the files in changeset to get all the paths # and for each path, find the current test/prod revision number and save that info chgset.append(changeset) format = req.args.get('format') self._render_html(req, ticket, repos, chgset, diff_options) req.hdf['setchangesets'] = setchangesets ticket['ticketaction'] = 'CloneTest' ticket.save_changes(req.authname, 'published to clone', 0, db) req.hdf['message'] += 'Successfully Published All Files' req.hdf['ticket'] = ticket.values else: req.hdf['error'] = 'Error: not in correct state to publish' return 'setchangeset.cs', None
def getTemplates( self, component, req ): #templates.xml is stored in the same directory as the testcases repository = self.getRepository( component, req ) authzperm = SubversionAuthorizer( component.env, req.authname) authzperm.assert_permission_for_changeset(repository.youngest_rev) node = repository.get_node( self.getTestCasePath( component, req ), repository.youngest_rev ) entries = node.get_entries() templates = [] #ok spin through the entries we only care about one called testtemplates.xml for entry in entries : match = re.match('testtemplates.xml', entry.get_name() ) if match: content = entry.get_content().read() return Templates( str(content), component ) #there should only be one testtemplates.xml file... #else: # component.env.log.debug( "didn't care about : " + entry.get_name() ) return None
def getTestCases(self, component, req): repository = self.getRepository(component, req) authzperm = SubversionAuthorizer(component.env, req.authname) authzperm.assert_permission_for_changeset(repository.youngest_rev) node = repository.get_node(self.getTestCasePath(component, req), repository.youngest_rev) entries = node.get_entries() testcases = {} #let's create the list of testcases... for entry in entries: match = re.match('testtemplates.xml', entry.get_name()) #we want to parse testcases not the testtemplate file... if not match: content = entry.get_content().read() testcase = TestCase(entry.get_name(), str(content), component) testcases[testcase.getId().encode('ascii', 'ignore').strip()] = testcase #first let's do some validation on the testcases... components = self.getComponents(component, req) currentTestcase = None try: for key, value in testcases.iteritems(): currentTestcase = value #incase we do toss an exception I'll want some information from this testcase components.index( value.getComponent().encode('ascii', 'ignore').strip() ) #this will toss an exception if the component in the testcase doesn't exist in the trac project except Exception, ex: req.hdf[ 'testcase.run.errormessage'] = "The component :" + currentTestcase.getComponent( ) + " in the testcase : " + currentTestcase.getId( ) + " does not exist in the trac project " component.env.log.debug("Error validating testcases " + repr(ex)) return None
def process_request(self, req): req.perm.assert_permission('CHANGESET_VIEW') ticket_id = req.args.get('ticket_id') req.hdf['ticket_id'] = ticket_id repos = self.env.get_repository(req.authname) authzperm = SubversionAuthorizer(self.env, req.authname) diff_options = get_diff_options(req) if req.args.has_key('update'): req.redirect(self.env.href.setchangeset(ticket_id)) ticket = Ticket(self.env, ticket_id) setchangesets = ticket.setchangesets # get the list of changesets for the ticket_id # then loop through and get the actual changesets like the following line chgset = [] for rev in setchangesets: authzperm.assert_permission_for_changeset(rev) changeset = repos.get_changeset(rev) chgset.append(changeset) req.check_modified(changeset.date, diff_options[0] + ''.join(diff_options[1])) format = req.args.get('format') self._render_html(req, ticket, repos, chgset, diff_options) add_link(req, 'alternate', '?format=diff', 'Unified Diff', 'text/plain', 'diff') add_link(req, 'alternate', '?format=zip', 'Zip Archive', 'application/zip', 'zip') add_stylesheet(req, 'common/css/changeset.css') add_stylesheet(req, 'common/css/diff.css') add_stylesheet(req, 'common/css/code.css') return 'setchangeset.cs', None
def getTemplates(self, component, req): #templates.xml is stored in the same directory as the testcases repository = self.getRepository(component, req) authzperm = SubversionAuthorizer(component.env, req.authname) authzperm.assert_permission_for_changeset(repository.youngest_rev) node = repository.get_node(self.getTestCasePath(component, req), repository.youngest_rev) entries = node.get_entries() templates = [] #ok spin through the entries we only care about one called testtemplates.xml for entry in entries: match = re.match('testtemplates.xml', entry.get_name()) if match: content = entry.get_content().read() return Templates( str(content), component ) #there should only be one testtemplates.xml file... #else: # component.env.log.debug( "didn't care about : " + entry.get_name() ) return None