eric6/VCS/VersionControl.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8260
2161475d9639
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
7 Module implementing an abstract base class to be subclassed by all specific 7 Module implementing an abstract base class to be subclassed by all specific
8 VCS interfaces. 8 VCS interfaces.
9 """ 9 """
10 10
11 import os 11 import os
12 import contextlib
12 13
13 from PyQt5.QtCore import ( 14 from PyQt5.QtCore import (
14 QObject, QThread, QMutex, QProcess, Qt, pyqtSignal, QCoreApplication 15 QObject, QThread, QMutex, QProcess, Qt, pyqtSignal, QCoreApplication
15 ) 16 )
16 from PyQt5.QtWidgets import QApplication 17 from PyQt5.QtWidgets import QApplication
49 Constructor 50 Constructor
50 51
51 @param parent parent widget (QWidget) 52 @param parent parent widget (QWidget)
52 @param name name of this object (string) 53 @param name name of this object (string)
53 """ 54 """
54 super(VersionControl, self).__init__(parent) 55 super().__init__(parent)
55 if name: 56 if name:
56 self.setObjectName(name) 57 self.setObjectName(name)
57 self.defaultOptions = { 58 self.defaultOptions = {
58 'global': [''], 59 'global': [''],
59 'commit': [''], 60 'commit': [''],
519 @param options a dictionary of option strings with keys as 520 @param options a dictionary of option strings with keys as
520 defined by the default options 521 defined by the default options
521 """ 522 """
522 if self.vcsSupportCommandOptions(): 523 if self.vcsSupportCommandOptions():
523 for key in options: 524 for key in options:
524 try: 525 with contextlib.suppress(KeyError):
525 self.options[key] = options[key] 526 self.options[key] = options[key]
526 except KeyError:
527 pass
528 527
529 def vcsGetOptions(self): 528 def vcsGetOptions(self):
530 """ 529 """
531 Public method used to retrieve the options of the vcs. 530 Public method used to retrieve the options of the vcs.
532 531
543 Public method used to set vcs specific data. 542 Public method used to set vcs specific data.
544 543
545 @param data a dictionary of vcs specific data 544 @param data a dictionary of vcs specific data
546 """ 545 """
547 for key in data: 546 for key in data:
548 try: 547 with contextlib.suppress(KeyError):
549 self.otherData[key] = data[key] 548 self.otherData[key] = data[key]
550 except KeyError:
551 pass
552 549
553 def vcsGetOtherData(self): 550 def vcsGetOtherData(self):
554 """ 551 """
555 Public method used to retrieve vcs specific data. 552 Public method used to retrieve vcs specific data.
556 553
715 Public method to start the VCS status monitor thread. 712 Public method to start the VCS status monitor thread.
716 713
717 @param project reference to the project object 714 @param project reference to the project object
718 @return reference to the monitor thread (QThread) 715 @return reference to the monitor thread (QThread)
719 """ 716 """
720 if project.pudata["VCSSTATUSMONITORINTERVAL"]: 717 vcsStatusMonitorInterval = (
721 vcsStatusMonitorInterval = project.pudata[ 718 project.pudata["VCSSTATUSMONITORINTERVAL"]
722 "VCSSTATUSMONITORINTERVAL"] 719 if project.pudata["VCSSTATUSMONITORINTERVAL"] else
723 else: 720 Preferences.getVCS("StatusMonitorInterval")
724 vcsStatusMonitorInterval = Preferences.getVCS( 721 )
725 "StatusMonitorInterval")
726 if vcsStatusMonitorInterval > 0: 722 if vcsStatusMonitorInterval > 0:
727 self.statusMonitorThread = self._createStatusMonitorThread( 723 self.statusMonitorThread = self._createStatusMonitorThread(
728 vcsStatusMonitorInterval, project) 724 vcsStatusMonitorInterval, project)
729 if self.statusMonitorThread is not None: 725 if self.statusMonitorThread is not None:
730 self.statusMonitorThread.vcsStatusMonitorData.connect( 726 self.statusMonitorThread.vcsStatusMonitorData.connect(

eric ide

mercurial