--- a/Plugins/VcsPlugins/vcsMercurial/HgRepoConfigDataDialog.py Thu Feb 27 19:48:55 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgRepoConfigDataDialog.py Fri Feb 28 18:24:24 2014 +0100 @@ -12,16 +12,22 @@ import UI.PixmapCache +from .LargefilesExtension import getDefaults as getLargefilesDefaults + class HgRepoConfigDataDialog(QDialog, Ui_HgRepoConfigDataDialog): """ Class implementing a dialog to enter data needed for the initial creation of a repository configuration file (hgrc). """ - def __init__(self, parent=None): + def __init__(self, withLargefiles=False, largefilesData=None, parent=None): """ Constructor + @param withLargefiles flag indicating to configure the largefiles + section (boolean) + @param largefilesData dictionary with data for the largefiles + section (dict) @param parent reference to the parent widget (QWidget) """ super().__init__(parent) @@ -32,6 +38,16 @@ self.defaultPushShowPasswordButton.setIcon( UI.PixmapCache.getIcon("showPassword.png")) + self.__withLargefiles = withLargefiles + if withLargefiles: + if largefilesData is None: + largefilesData = getLargefilesDefaults() + self.lfFileSizeSpinBox.setValue(largefilesData["minsize"]) + self.lfFilePatternsEdit.setText( + " ".join(largefilesData["pattern"])) + else: + self.largefilesGroup.setVisible(False) + self.resize(self.width(), self.minimumSizeHint().height()) @pyqtSlot(bool) @@ -92,3 +108,24 @@ defaultPushUrl = defaultPushUrl.toString() return defaultUrl, defaultPushUrl + + def getLargefilesData(self): + """ + Public method to get the data for the largefiles extension. + + @return tuple with the minimum file size (integer) and file patterns + (list of string). None as value denote to use the default value. + """ + if self.__withLargefiles: + lfDefaults = getLargefilesDefaults() + if self.lfFileSizeSpinBox.value() == lfDefaults["minsize"]: + minsize = None + else: + minsize = self.lfFileSizeSpinBox.value() + patterns = self.lfFilePatternsEdit.text().split() + if set(patterns) == set(lfDefaults["pattern"]): + patterns = None + + return minsize, patterns + else: + return None, None