def __normalizeSelected( self ): " Puts the earliest revision first " if self.__lhsSelected is not None and self.__rhsSelected is not None: # It might be necessary to exchange the versions if self.__rhsSelected.date < self.__lhsSelected.date: temp = self.__rhsSelected self.__rhsSelected = self.__lhsSelected self.__lhsSelected = temp self.__diffButton.setEnabled( True ) else: self.__diffButton.setEnabled( False ) if self.__lhsSelected is None: self.__lhsRevisionLabel.setText( "" ) self.__lhsRevisionLabel.setToolTip( "" ) self.__lhsResetButton.setEnabled( False ) else: self.__lhsRevisionLabel.setText( str( self.__lhsSelected.revision.number ) + " (" + timestampToString( self.__lhsSelected.date ) + ")" ) self.__lhsRevisionLabel.setToolTip( str( self.__lhsSelected.message ) ) self.__lhsResetButton.setEnabled( True ) if self.__rhsSelected is None: self.__rhsRevisionLabel.setText( "" ) self.__rhsRevisionLabel.setToolTip( "" ) self.__rhsResetButton.setEnabled( False ) else: self.__rhsRevisionLabel.setText( str( self.__rhsSelected.revision.number ) + " (" + timestampToString( self.__rhsSelected.date ) + ")" ) self.__rhsRevisionLabel.setToolTip( str( self.__rhsSelected.message ) ) self.__rhsResetButton.setEnabled( True ) return
def __getLockInfo(lockInfo): " Provides lock info as a list of strings " info = [] if 'owner' in lockInfo: if lockInfo['owner']: info.append("Owner: " + lockInfo['owner']) else: info.append("Owner: Unknown") if 'creation_date' in lockInfo: if lockInfo['creation_date']: info.append("Creation date: " + timestampToString(lockInfo['creation_date'])) else: info.append("Creation date: Unknown") if 'expiration_date' in lockInfo: if lockInfo['expiration_date']: info.append("Expiration date: " + timestampToString(lockInfo['expiration_date'])) else: info.append("Expiration date: Unknown") if 'token' in lockInfo: if lockInfo['token']: info.append("Token: " + lockInfo['token']) else: info.append("Token: None") if 'comment' in lockInfo: if lockInfo['comment']: info.append("Comment: " + lockInfo['comment']) else: info.append("Comment: None") return info
def __normalizeSelected(self): " Puts the earliest revision first " if self.__lhsSelected is not None and self.__rhsSelected is not None: # It might be necessary to exchange the versions if self.__rhsSelected.date < self.__lhsSelected.date: temp = self.__rhsSelected self.__rhsSelected = self.__lhsSelected self.__lhsSelected = temp self.__diffButton.setEnabled(True) else: self.__diffButton.setEnabled(False) if self.__lhsSelected is None: self.__lhsRevisionLabel.setText("") self.__lhsRevisionLabel.setToolTip("") self.__lhsResetButton.setEnabled(False) else: self.__lhsRevisionLabel.setText( str(self.__lhsSelected.revision.number) + " (" + timestampToString(self.__lhsSelected.date) + ")") self.__lhsRevisionLabel.setToolTip(str(self.__lhsSelected.message)) self.__lhsResetButton.setEnabled(True) if self.__rhsSelected is None: self.__rhsRevisionLabel.setText("") self.__rhsRevisionLabel.setToolTip("") self.__rhsResetButton.setEnabled(False) else: self.__rhsRevisionLabel.setText( str(self.__rhsSelected.revision.number) + " (" + timestampToString(self.__rhsSelected.date) + ")") self.__rhsRevisionLabel.setToolTip(str(self.__rhsSelected.message)) self.__rhsResetButton.setEnabled(True) return
def __getLockInfo( lockInfo ): " Provides lock info as a list of strings " info = [] if 'owner' in lockInfo: if lockInfo[ 'owner' ]: info.append( "Owner: " + lockInfo[ 'owner' ] ) else: info.append( "Owner: Unknown" ) if 'creation_date' in lockInfo: if lockInfo[ 'creation_date' ]: info.append( "Creation date: " + timestampToString( lockInfo[ 'creation_date' ] ) ) else: info.append( "Creation date: Unknown" ) if 'expiration_date' in lockInfo: if lockInfo[ 'expiration_date' ]: info.append( "Expiration date: " + timestampToString( lockInfo[ 'expiration_date' ] ) ) else: info.append( "Expiration date: Unknown" ) if 'token' in lockInfo: if lockInfo[ 'token' ]: info.append( "Token: " + lockInfo[ 'token' ] ) else: info.append( "Token: None" ) if 'comment' in lockInfo: if lockInfo[ 'comment' ]: info.append( "Comment: " + lockInfo[ 'comment' ] ) else: info.append( "Comment: None" ) return info
def __init__( self, logInfo ): self.logInfo = logInfo message = "" if logInfo.message: message = str( logInfo.message ) authorTooltip = "" author = "" if logInfo.author: authorTooltip = str( logInfo.author ) author = authorTooltip.split( "@", 1 )[ 0 ] revision = "" if logInfo.revision: if logInfo.revision.number: revision = str( logInfo.revision.number ) date = "" if logInfo.date: date = timestampToString( logInfo.date ) QTreeWidgetItem.__init__( self, [ "", "", revision, date, author, message ] ) self.setCheckState( SELECT_COL, Qt.Unchecked ) self.setToolTip( REVISION_COL, revision ) self.setToolTip( DATE_COL, date ) self.setToolTip( AUTHOR_COL, authorTooltip ) self.setToolTip( MESSAGE_COL, message ) return
def __init__(self, logInfo): self.logInfo = logInfo message = "" if logInfo.message: message = str(logInfo.message) authorTooltip = "" author = "" if logInfo.author: authorTooltip = str(logInfo.author) author = authorTooltip.split("@", 1)[0] revision = "" if logInfo.revision: if logInfo.revision.number: revision = str(logInfo.revision.number) date = "" if logInfo.date: date = timestampToString(logInfo.date) QTreeWidgetItem.__init__(self, ["", "", revision, date, author, message]) self.setCheckState(SELECT_COL, Qt.Unchecked) self.setToolTip(REVISION_COL, revision) self.setToolTip(DATE_COL, date) self.setToolTip(AUTHOR_COL, authorTooltip) self.setToolTip(MESSAGE_COL, message) return
def __svnInfo(self, path): " Implementation of the info command for a file " status = self.getLocalStatus(path) if status == IND_ERROR: logging.error("Error getting status of " + path) return if status == self.NOT_UNDER_VCS: logging.info("Status: " + statusToString(status)) return client = self.getSVNClient(self.getSettings()) # Local info throws exceptions if something is broken itemPath, localInfoObject = getSVNInfo(client, path) serverInfoObject = self.getServerInfoObject(client, localInfoObject) serverProperties = self.__lastCommitProperties(client, serverInfoObject) localStatusObject = self.getLocalStatusObject(client, itemPath) localProperties = self.__localProperties(client, itemPath) message = "\nServer Info:" if serverInfoObject is None: message += "\n Error getting server info" else: message += "\n Last commit:" message += "\n Revision: " + str( serverInfoObject.last_changed_rev.number) message += "\n Timestamp: " + timestampToString( serverInfoObject.last_changed_date) message += "\n Author: " + str( serverInfoObject.last_changed_author) message += "\n Message: " + str( self.__lastCommitMessage(client, serverInfoObject)) message += "\n Properties:" if serverProperties is None: message += "\n Error getting server properties" else: if len(serverProperties) == 0: message += "\n No properties" else: for key in serverProperties.keys(): message += "\n " + key + ": " + serverProperties[ key] if serverInfoObject.lock is None: message += "\n Locked: False" else: message += "\n Locked: True" for line in self.__getLockInfo(serverInfoObject.lock): message += "\n " + line message += "\n Node:" message += "\n URL: " + serverInfoObject.URL message += "\n Repository root URL: " + serverInfoObject.repos_root_URL message += "\n Repository UUID: " + serverInfoObject.repos_UUID message += "\n Kind: " + nodeKindToString( serverInfoObject.kind) message += "\nLocal Info:" if localInfoObject is None: message += "\n Error getting local info" else: message += "\n Status:" message += "\n Content: " + rawStatusToString( localStatusObject.text_status) message += "\n Properties: " + rawStatusToString( localStatusObject.prop_status) message += "\n Checkout:" message += "\n Revision: " + str( localInfoObject.last_changed_rev.number) message += "\n Timestamp: " + timestampToString( localInfoObject.last_changed_date) message += "\n Author: " + str( localInfoObject.last_changed_author) message += "\n Properties:" if localProperties is None: message += "\n Error getting local properties" else: if len(localProperties) == 0: message += "\n No properties" else: for key in localProperties.keys(): message += "\n " + key + ": " + localProperties[ key] if localInfoObject.lock is None: message += "\n Locked: False" else: message += "\n Locked: True" for line in self.__getLockInfo(localInfoObject.lock): message += "\n " + line message += "\n Node:" message += "\n Path: " + itemPath message += "\n Copied: " + str( bool(localStatusObject.is_copied)) message += "\n Switched: " + str( bool(localStatusObject.is_switched)) message += "\n Schedule: " + scheduleToString( localInfoObject.wc_info.schedule) logging.info(message) client = None return
def __svnInfo( self, path ): " Implementation of the info command for a file " status = self.getLocalStatus( path ) if status == IND_ERROR: logging.error( "Error getting status of " + path ) return if status == self.NOT_UNDER_VCS: logging.info( "Status: " + statusToString( status ) ) return client = self.getSVNClient( self.getSettings() ) # Local info throws exceptions if something is broken itemPath, localInfoObject = getSVNInfo( client, path ) serverInfoObject = self.getServerInfoObject( client, localInfoObject ) serverProperties = self.__lastCommitProperties( client, serverInfoObject ) localStatusObject = self.getLocalStatusObject( client, itemPath ) localProperties = self.__localProperties( client, itemPath ) message = "\nServer Info:" if serverInfoObject is None: message += "\n Error getting server info" else: message += "\n Last commit:" message += "\n Revision: " + str( serverInfoObject.last_changed_rev.number ) message += "\n Timestamp: " + timestampToString( serverInfoObject.last_changed_date ) message += "\n Author: " + str( serverInfoObject.last_changed_author ) message += "\n Message: " + str( self.__lastCommitMessage( client, serverInfoObject ) ) message += "\n Properties:" if serverProperties is None: message += "\n Error getting server properties" else: if len( serverProperties ) == 0: message += "\n No properties" else: for key in serverProperties.keys(): message += "\n " + key + ": " + serverProperties[ key ] if serverInfoObject.lock is None: message += "\n Locked: False" else: message += "\n Locked: True" for line in self.__getLockInfo( serverInfoObject.lock ): message += "\n " + line message += "\n Node:" message += "\n URL: " + serverInfoObject.URL message += "\n Repository root URL: " + serverInfoObject.repos_root_URL message += "\n Repository UUID: " + serverInfoObject.repos_UUID message += "\n Kind: " + nodeKindToString( serverInfoObject.kind ) message += "\nLocal Info:" if localInfoObject is None: message += "\n Error getting local info" else: message += "\n Status:" message += "\n Content: " + rawStatusToString( localStatusObject.text_status ) message += "\n Properties: " + rawStatusToString( localStatusObject.prop_status ) message += "\n Checkout:" message += "\n Revision: " + str( localInfoObject.last_changed_rev.number ) message += "\n Timestamp: " + timestampToString( localInfoObject.last_changed_date ) message += "\n Author: " + str( localInfoObject.last_changed_author ) message += "\n Properties:" if localProperties is None: message += "\n Error getting local properties" else: if len( localProperties ) == 0: message += "\n No properties" else: for key in localProperties.keys(): message += "\n " + key + ": " + localProperties[ key ] if localInfoObject.lock is None: message += "\n Locked: False" else: message += "\n Locked: True" for line in self.__getLockInfo( localInfoObject.lock ): message += "\n " + line message += "\n Node:" message += "\n Path: " + itemPath message += "\n Copied: " + str( bool( localStatusObject.is_copied ) ) message += "\n Switched: " + str( bool( localStatusObject.is_switched ) ) message += "\n Schedule: " + scheduleToString( localInfoObject.wc_info.schedule ) logging.info( message ) client = None return