Esempio n. 1
0
 def svnFileCommit(fname, msg = None, parent = None):
     import os
     fname = os.path.abspath(fname)
     if not isSvnAddedFile(fname) and not svnIsUpToDate(fname, parent, True):
         QMessageBox.question(parent,'Update first', repr(os.path.basename(fname))+' is not up to date.\nUpdate first.')
         return
     if msg is None :
         if parent is None:
             msg = ''
         else:
             ok, msg = get_log(parent, 'SVN Commit - '+os.path.basename(fname))
             if not ok: return
     client = get_svn_client()
     cwd = os.getcwd()
     os.chdir(os.path.dirname(fname))
     res = client.checkin(fname,msg)
     os.chdir(cwd)
     return res
Esempio n. 2
0
 def svnUpdate(fname, parent = None):
     global svn_client_gui_parent
     client = get_svn_client()
     svn_client_gui_parent = parent
     import os
     fname = os.path.abspath(fname)
     local_rev = client.info2(fname)[0][1]['rev']
     try:
         rev = client.update(fname)
         if type(rev) is list: rev = rev[0]
         if local_rev.number == rev.number:
             if parent : QMessageBox.question(parent,'Update', 'Your version is already up-to-date : %s' % rev.number)
             return False
         else:
             if parent : QMessageBox.question(parent,'Update', 'Updated at revision %s' % rev.number)
             return True
     except pysvn.ClientError as ce:
         QMessageBox.warning(parent,'Update', ce.message)
         return False
Esempio n. 3
0
 def svnIsUpToDate( fname, parent = None, silent = False):
     import os
     global svn_client_gui_parent
     client = get_svn_client()
     svn_client_gui_parent = parent
     import os
     fname = os.path.abspath(fname)
     local_entry_list = client.info2(fname)[0]
     current_entry = local_entry_list[1]
     current_rev = current_entry['rev']
     try:
         server_entry_list = client.info2(fname,revision = pysvn.Revision( pysvn.opt_revision_kind.head ))[0]
         server_entry = server_entry_list[1]
         server_rev = server_entry['last_changed_rev']
         if current_rev.number < server_rev.number:
             if not silent and parent:
                 changelogs = client.log(fname,revision_start = server_rev, revision_end = current_rev)
                 msg = os.path.basename(fname) +'\nA new version of the model exists : %s (current=%s).\n' % (server_rev.number,current_rev.number)
                 for log in changelogs:
                     msg += " - [%s][%s] '%s'\n" % (log.revision.number,log.author,log.message)
                 msg += "Status : "+str(svnFileTextStatus(fname))
                 QMessageBox.question(parent,'Up-to-date',msg )
             return False
         else:
             if not silent and parent:
                 msg = os.path.basename(fname) +'\nYour version is up-to-date.\nRevision: %s.\n' % (current_rev.number)
                 if server_entry['last_changed_date']:
                     import time
                     msg += 'Last changed date : %s\n' % time.asctime(time.gmtime(server_entry['last_changed_date']))
                 if server_entry['last_changed_author']:
                     msg += 'Last changed author : %s\n' % server_entry['last_changed_author']
                 msg += "Status : "+str(svnFileTextStatus(fname))
                 QMessageBox.question(parent,'Up-to-date', msg)                
             return True
     except pysvn.ClientError as ce:
         if not silent and parent: 
             QMessageBox.warning(parent,'Up-to-date', ce.message)
             return True
         else:
             raise ce
Esempio n. 4
0
 def ssl_server_trust_prompt(trust_dict ):
     if svn_client_gui_parent is None: return True, True, True
     msg = 'The authenticity of host "%s" can\' t be established.\nRSA key fingerprint is %s.\nValid from %s to %s.\nCertified by %s.\nAccept ?'
     msg = msg % (trust_dict['hostname'], trust_dict['finger_print'],trust_dict['valid_from'],trust_dict['valid_until'],trust_dict['issuer_dname'])
     ok = QMessageBox.question(svn_client_gui_parent,'RSA Authentification of '+trust_dict['realm'], msg, QMessageBox.Ok,QMessageBox.Cancel )
     return ok == QMessageBox.Ok, True, True