Changeset 1650

Show
Ignore:
Timestamp:
12/05/06 12:04:30 (2 years ago)
Author:
bmcquay
Message:

PublishRevertPlugin:

syncing changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • publishrevertplugin/publishrevert/setchangeset.py

    r1588 r1650  
    3939 
    4040    implements(INavigationContributor, IPermissionRequestor, IRequestHandler, 
    41                ITimelineEventProvider, IWikiSyntaxProvider, ISearchSource, ITemplateProvider) 
     41               ITimelineEventProvider, IWikiSyntaxProvider, ISearchSource, ITemplateProvider)  
     42 
     43# need to add IRequestFilter when we upgrade 
    4244 
    4345    # INavigationContributor methods 
     
    9395         
    9496        setchangesets = ticket.setchangesets 
     97        req.hdf['ticket'] = ticket 
    9598 
    9699        # get the list of changesets for the ticket_id 
     
    107110 
    108111        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') 
    116112        return 'setchangeset.cs', None 
    117113 
     
    195191 
    196192            for path, kind, change, base_path, base_rev in changeset.get_changes(): 
    197  
    198193               info = {'change': change} 
    199194               if base_path: 
     
    217212               hidden_properties = [p.strip() for p 
    218213                             in self.config.get('browser', 'hide_properties').split(',')] 
    219  
    220214 
    221215 
     
    399393        ticket._old = {} 
    400394        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  
    5656    default_ssh_user = "trac" 
    5757    default_htdoc_path = "/var/www/vra1" 
     58    default_lockfile = '/var/www/vra1/trunk/www/trac_publishrevert' 
    5859 
    5960    # INavigationContributor methods 
     
    7980 
    8081    def process_request(self, req, db=None): 
    81         req.perm.assert_permission('CHANGESET_VIEW') 
     82        req.perm.assert_permission('TRAC_ADMIN') 
    8283 
    8384        if not db: 
     
    9596 
    9697        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) 
    107110 
    108111            # now loop through the files in changeset to get all the paths 
    109112            # 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 
    122127 
    123128    # ITimelineEventProvider methods 
     
    199204                                                                    rev=changeset.rev) 
    200205 
    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)) 
    203208 
    204209               if self.use_file(info, filepaths): 
    205210                       filepaths.append(info) 
    206                        idx += 1 
    207211 
    208212               hidden_properties = [p.strip() for p 
     
    210214 
    211215   # the following lines probably belong outside of this _render_html function and inside process_request instead 
     216        self.svn_init() 
    212217        for info in filepaths: 
    213218            info['prod_rev'] = self.svn_rev_num(path) 
     
    224229               self.svn_update(server,info['path.new'],info['rev.new']) 
    225230            req.hdf['setchangeset.changes.%d' % idx] = info 
    226  
     231            idx += 1 
     232        self.svn_close() 
    227233 
    228234    def use_file(self, newchange, filepaths): 
     
    359365        if(commit): 
    360366            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  
    5656    default_ssh_user = "trac" 
    5757    default_htdoc_path = "/var/www/vra1" 
     58    default_lockfile = '/var/www/vra1/trunk/www/trac_publishrevert' 
    5859 
    5960    # INavigationContributor methods 
     
    7980 
    8081    def process_request(self, req, db=None): 
    81         req.perm.assert_permission('CHANGESET_VIEW') 
     82        req.perm.assert_permission('TRAC_ADMIN') 
    8283 
    8384        if not db: 
     
    9596 
    9697        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 
    122126 
    123127    # ITimelineEventProvider methods 
     
    204208               if self.use_file(info, filepaths): 
    205209                       filepaths.append(info) 
    206                        idx += 1 
    207210 
    208211               hidden_properties = [p.strip() for p 
     
    210213 
    211214   # the following lines probably belong outside of this _render_html function and inside process_request instead 
     215        self.svn_init() 
    212216        for info in filepaths: 
    213217            revert_rev = self.db_rev_num(1,path) 
     
    215219            self.svn_update(server,info['path.new'],revert_rev) 
    216220            req.hdf['setchangeset.changes.%d' % idx] = info 
    217  
     221            idx += 1 
     222        self.svn_close() 
    218223 
    219224    def use_file(self, newchange, filepaths): 
     
    348353        if(commit): 
    349354            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  
    33 
    44<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' ?> 
    77<a href="../svnpublish/<?cs var:ticket_id ?>">PUBLISH TO CLONE</a><br/> 
     8<?cs /if ?> 
     9<?cs if:ticket['ticketaction'] == 'CloneTest' ?> 
    810<a href="../svnrevert/<?cs var:ticket_id ?>">REVERT CLONE</a> 
     11<?cs /if ?> 
    912 
    1013<?cs def:node_change(item,cl,kind) ?><?cs  
     
    3942 
    4043<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> 
    4249 <dd class="time"><?cs 
    4350 each:changeset = ticket.setchangesets ?> 
     
    5764</dl> 
    5865 
    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> 
    7366<?cs include "footer.cs"?> 
  • publishrevertplugin/TracPublishRevert.egg-info/SOURCES.txt

    r1614 r1650  
    1313publishrevert/svnrevert.py 
    1414publishrevert/templates/setchangeset.cs 
    15 publishrevert/templates/svnpublish.cs 
    1615scripts/svn_rev_check.rb