Changeset 1650
- Timestamp:
- 12/05/06 12:04:30 (2 years ago)
- Files:
-
- publishrevertplugin/publishrevert/__init__.py~ (added)
- publishrevertplugin/publishrevert/__init__.pyc (added)
- publishrevertplugin/publishrevert/setchangeset.py (modified) (6 diffs)
- publishrevertplugin/publishrevert/setchangeset.py~ (added)
- publishrevertplugin/publishrevert/setchangeset.pyc (added)
- publishrevertplugin/publishrevert/svnpublish.py (modified) (7 diffs)
- publishrevertplugin/publishrevert/svnpublish.py~ (added)
- publishrevertplugin/publishrevert/svnpublish.pyc (added)
- publishrevertplugin/publishrevert/svnrevert.py (modified) (7 diffs)
- publishrevertplugin/publishrevert/svnrevert.py~ (added)
- publishrevertplugin/publishrevert/svnrevert.pyc (added)
- publishrevertplugin/publishrevert/templates/setchangeset.cs (modified) (3 diffs)
- publishrevertplugin/publishrevert/templates/svnpublish.cs (deleted)
- publishrevertplugin/publishrevert/templates/svnrevert.cs (deleted)
- publishrevertplugin/TracPublishRevert.egg-info/SOURCES.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
publishrevertplugin/publishrevert/setchangeset.py
r1588 r1650 39 39 40 40 implements(INavigationContributor, IPermissionRequestor, IRequestHandler, 41 ITimelineEventProvider, IWikiSyntaxProvider, ISearchSource, ITemplateProvider) 41 ITimelineEventProvider, IWikiSyntaxProvider, ISearchSource, ITemplateProvider) 42 43 # need to add IRequestFilter when we upgrade 42 44 43 45 # INavigationContributor methods … … 93 95 94 96 setchangesets = ticket.setchangesets 97 req.hdf['ticket'] = ticket 95 98 96 99 # get the list of changesets for the ticket_id … … 107 110 108 111 self._render_html(req, ticket, repos, chgset, diff_options) 109 add_link(req, 'alternate', '?format=diff', 'Unified Diff',110 'text/plain', 'diff')111 add_link(req, 'alternate', '?format=zip', 'Zip Archive',112 'application/zip', 'zip')113 add_stylesheet(req, 'common/css/changeset.css')114 add_stylesheet(req, 'common/css/diff.css')115 add_stylesheet(req, 'common/css/code.css')116 112 return 'setchangeset.cs', None 117 113 … … 195 191 196 192 for path, kind, change, base_path, base_rev in changeset.get_changes(): 197 198 193 info = {'change': change} 199 194 if base_path: … … 217 212 hidden_properties = [p.strip() for p 218 213 in self.config.get('browser', 'hide_properties').split(',')] 219 220 214 221 215 … … 399 393 ticket._old = {} 400 394 ticket.time_changed = when 395 396 def post_process_request(self, req, template, content_type): 397 match = re.match(r'/ticket/([0-9]+)$', req.path_info) 398 if match: 399 req.hdf['ticket.setchangeset'] = Markup('<a href="...">...</a>') publishrevertplugin/publishrevert/svnpublish.py
r1614 r1650 56 56 default_ssh_user = "trac" 57 57 default_htdoc_path = "/var/www/vra1" 58 default_lockfile = '/var/www/vra1/trunk/www/trac_publishrevert' 58 59 59 60 # INavigationContributor methods … … 79 80 80 81 def process_request(self, req, db=None): 81 req.perm.assert_permission(' CHANGESET_VIEW')82 req.perm.assert_permission('TRAC_ADMIN') 82 83 83 84 if not db: … … 95 96 96 97 ticket = Ticket(self.env, ticket_id) 97 from publishrevert.setchangeset import SetChangesetModule 98 setchangeset = SetChangesetModule(self.env) 99 setchangesets = setchangeset.get_setchangesets(ticket_id) 100 101 # get the list of changesets for the ticket_id 102 # then loop through and get the actual changesets like the following line 103 chgset = [] 104 for rev in setchangesets: 105 authzperm.assert_permission_for_changeset(rev) 106 changeset = repos.get_changeset(rev) 98 chgset = [] 99 100 if(ticket['ticketaction'] == "ClonePublish"): 101 from publishrevert.setchangeset import SetChangesetModule 102 setchangeset = SetChangesetModule(self.env) 103 setchangesets = setchangeset.get_setchangesets(ticket_id) 104 105 # get the list of changesets for the ticket_id 106 # then loop through and get the actual changesets like the following line 107 for rev in setchangesets: 108 authzperm.assert_permission_for_changeset(rev) 109 changeset = repos.get_changeset(rev) 107 110 108 111 # now loop through the files in changeset to get all the paths 109 112 # and for each path, find the current test/prod revision number and save that info 110 chgset.append(changeset) 111 req.check_modified(changeset.date, 112 diff_options[0] + ''.join(diff_options[1])) 113 114 format = req.args.get('format') 115 116 self._render_html(req, ticket, repos, chgset, diff_options) 117 req.hdf['setchangesets'] = setchangesets 118 add_stylesheet(req, 'common/css/changeset.css') 119 add_stylesheet(req, 'common/css/diff.css') 120 add_stylesheet(req, 'common/css/code.css') 121 return 'svnpublish.cs', None 113 chgset.append(changeset) 114 req.check_modified(changeset.date, 115 diff_options[0] + ''.join(diff_options[1])) 116 117 format = req.args.get('format') 118 self._render_html(req, ticket, repos, chgset, diff_options) 119 req.hdf['setchangesets'] = setchangesets 120 ticket['ticketaction'] = 'CloneTest' 121 ticket.save_changes(req.authname, 'published to clone', 0, db) 122 req.hdf['message'] = 'Successfully Published All Files' 123 else: 124 req.hdf['error'] = 'Error: not in correct state to publish' 125 126 return 'setchangeset.cs', None 122 127 123 128 # ITimelineEventProvider methods … … 199 204 rev=changeset.rev) 200 205 201 if change in (Changeset.COPY, Changeset.EDIT, Changeset.MOVE):202 edits.append((idx, path, kind, base_path, base_rev))206 # if change in (Changeset.COPY, Changeset.EDIT, Changeset.MOVE): 207 edits.append((idx, path, kind, base_path, base_rev)) 203 208 204 209 if self.use_file(info, filepaths): 205 210 filepaths.append(info) 206 idx += 1207 211 208 212 hidden_properties = [p.strip() for p … … 210 214 211 215 # the following lines probably belong outside of this _render_html function and inside process_request instead 216 self.svn_init() 212 217 for info in filepaths: 213 218 info['prod_rev'] = self.svn_rev_num(path) … … 224 229 self.svn_update(server,info['path.new'],info['rev.new']) 225 230 req.hdf['setchangeset.changes.%d' % idx] = info 226 231 idx += 1 232 self.svn_close() 227 233 228 234 def use_file(self, newchange, filepaths): … … 359 365 if(commit): 360 366 db.commit() 367 368 def svn_init(self): 369 # touch the file 370 cmd="%s/ssh %s@%s touch %s" % (self.default_ssh_path, self.default_ssh_user, self.default_test_remote_host, self.default_lockfile) 371 output = commands.getoutput(cmd) 372 373 def svn_close(self): 374 # delete the file 375 cmd="%s/ssh %s@%s rm -f %s" % (self.default_ssh_path, self.default_ssh_user, self.default_test_remote_host, self.default_lockfile) 376 output = commands.getoutput(cmd) publishrevertplugin/publishrevert/svnrevert.py
r1614 r1650 56 56 default_ssh_user = "trac" 57 57 default_htdoc_path = "/var/www/vra1" 58 default_lockfile = '/var/www/vra1/trunk/www/trac_publishrevert' 58 59 59 60 # INavigationContributor methods … … 79 80 80 81 def process_request(self, req, db=None): 81 req.perm.assert_permission(' CHANGESET_VIEW')82 req.perm.assert_permission('TRAC_ADMIN') 82 83 83 84 if not db: … … 95 96 96 97 ticket = Ticket(self.env, ticket_id) 97 from publishrevert.setchangeset import SetChangesetModule 98 setchangeset = SetChangesetModule(self.env) 99 setchangesets = setchangeset.get_setchangesets(ticket_id) 100 101 # get the list of changesets for the ticket_id 102 # then loop through and get the actual changesets like the following line 103 chgset = [] 104 for rev in setchangesets: 105 authzperm.assert_permission_for_changeset(rev) 106 changeset = repos.get_changeset(rev) 107 108 # now loop through the files in changeset to get all the paths 109 # and for each path, find the current test/prod revision number and save that info 110 chgset.append(changeset) 111 req.check_modified(changeset.date, 112 diff_options[0] + ''.join(diff_options[1])) 113 114 format = req.args.get('format') 115 116 self._render_html(req, ticket, repos, chgset, diff_options) 117 req.hdf['setchangesets'] = setchangesets 118 add_stylesheet(req, 'common/css/changeset.css') 119 add_stylesheet(req, 'common/css/diff.css') 120 add_stylesheet(req, 'common/css/code.css') 121 return 'svnrevert.cs', None 98 if(ticket['ticketaction'] == "CloneTest"): 99 from publishrevert.setchangeset import SetChangesetModule 100 setchangeset = SetChangesetModule(self.env) 101 setchangesets = setchangeset.get_setchangesets(ticket_id) 102 103 # get the list of changesets for the ticket_id 104 # then loop through and get the actual changesets like the following line 105 chgset = [] 106 for rev in setchangesets: 107 authzperm.assert_permission_for_changeset(rev) 108 changeset = repos.get_changeset(rev) 109 110 # now loop through the files in changeset to get all the paths 111 # and for each path, find the current test/prod revision number and save that info 112 chgset.append(changeset) 113 req.check_modified(changeset.date, 114 diff_options[0] + ''.join(diff_options[1])) 115 116 format = req.args.get('format') 117 self._render_html(req, ticket, repos, chgset, diff_options) 118 req.hdf['setchangesets'] = setchangesets 119 ticket['ticketaction'] = 'Doing' 120 ticket.save_changes(req.authname, 'reverted clone', 0, db) 121 req.hdf['message'] = 'Successfully Reverted All Files' 122 else: 123 req.hdf['error'] = 'Error: not in correct state to publish' 124 125 return 'setchangeset.cs', None 122 126 123 127 # ITimelineEventProvider methods … … 204 208 if self.use_file(info, filepaths): 205 209 filepaths.append(info) 206 idx += 1207 210 208 211 hidden_properties = [p.strip() for p … … 210 213 211 214 # the following lines probably belong outside of this _render_html function and inside process_request instead 215 self.svn_init() 212 216 for info in filepaths: 213 217 revert_rev = self.db_rev_num(1,path) … … 215 219 self.svn_update(server,info['path.new'],revert_rev) 216 220 req.hdf['setchangeset.changes.%d' % idx] = info 217 221 idx += 1 222 self.svn_close() 218 223 219 224 def use_file(self, newchange, filepaths): … … 348 353 if(commit): 349 354 db.commit() 355 356 def svn_init(self): 357 # touch the file 358 cmd="%s/ssh %s@%s touch %s" % (self.default_ssh_path, self.default_ssh_user, self.default_test_remote_host, self.default_lockfile) 359 output = commands.getoutput(cmd) 360 361 def svn_close(self): 362 # delete the file 363 cmd="%s/ssh %s@%s rm -f %s" % (self.default_ssh_path, self.default_ssh_user, self.default_test_remote_host, self.default_lockfile) 364 output = commands.getoutput(cmd) publishrevertplugin/publishrevert/templates/setchangeset.cs
r1614 r1650 3 3 4 4 <div id="content" class="changeset"> 5 <h1>Ticket <a href="../ticket/<?cs var:ticket_id ?>"><?cs var:ticket_id ?></a> </h1>6 5 <h1>Ticket <a href="../ticket/<?cs var:ticket_id ?>"><?cs var:ticket_id ?></a> <?cs var:ticket['ticketaction'] ?></h1> 6 <?cs if:ticket['ticketaction'] == 'ClonePublish' ?> 7 7 <a href="../svnpublish/<?cs var:ticket_id ?>">PUBLISH TO CLONE</a><br/> 8 <?cs /if ?> 9 <?cs if:ticket['ticketaction'] == 'CloneTest' ?> 8 10 <a href="../svnrevert/<?cs var:ticket_id ?>">REVERT CLONE</a> 11 <?cs /if ?> 9 12 10 13 <?cs def:node_change(item,cl,kind) ?><?cs … … 39 42 40 43 <dl id="overview"> 41 <dt class="time">Changesets</dt> 44 <dt class="time">Errors:</dt><dd><?cs var:error ?> 45 </dd> 46 <dt class="time">Messages:</dt><dd><?cs var:message ?> 47 </dd> 48 <dt class="time">Changesets:</dt> 42 49 <dd class="time"><?cs 43 50 each:changeset = ticket.setchangesets ?> … … 57 64 </dl> 58 65 59 <div class="diff">60 <div id="legend">61 <h3>Legend:</h3>62 <dl>63 <dt class="unmod"></dt><dd>Unmodified</dd>64 <dt class="add"></dt><dd>Added</dd>65 <dt class="rem"></dt><dd>Removed</dd>66 <dt class="mod"></dt><dd>Modified</dd>67 <dt class="cp"></dt><dd>Copied</dd>68 <dt class="mv"></dt><dd>Moved</dd>69 </dl>70 </div>71 72 </div>73 66 <?cs include "footer.cs"?> publishrevertplugin/TracPublishRevert.egg-info/SOURCES.txt
r1614 r1650 13 13 publishrevert/svnrevert.py 14 14 publishrevert/templates/setchangeset.cs 15 publishrevert/templates/svnpublish.cs16 15 scripts/svn_rev_check.rb
