Wed, 26 Feb 2014 19:39:29 +0100
Started implementing support for the Mercurial largefiles extension.
--- a/Plugins/VcsPlugins/vcsMercurial/ConfigurationPage/MercurialPage.py Tue Feb 25 19:37:17 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/ConfigurationPage/MercurialPage.py Wed Feb 26 19:39:29 2014 +0100 @@ -118,10 +118,11 @@ from ..HgUserConfigDataDialog import HgUserConfigDataDialog dlg = HgUserConfigDataDialog() if dlg.exec_() == QDialog.Accepted: - firstName, lastName, email, extensions = dlg.getData() + firstName, lastName, email, extensions, extensionsData = \ + dlg.getData() else: - firstName, lastName, email, extensions = ( - "Firstname", "Lastname", "email_address", []) + firstName, lastName, email, extensions, extensionsData = ( + "Firstname", "Lastname", "email_address", [], {}) try: f = open(cfgFile, "w") f.write("[ui]\n") @@ -131,6 +132,15 @@ f.write("\n[extensions]\n") f.write(" =\n".join(extensions)) f.write(" =\n") # complete the last line + if "largefiles" in extensionsData: + dataDict = extensionsData["largefiles"] + f.write("\n[largefiles]\n") + if "minsize" in dataDict: + f.write("minsize = {0}\n".format(dataDict["minsize"])) + if "patterns" in dataDict: + f.write("patterns =\n") + f.write(" {0}\n".format( + "\n ".join(dataDict["patterns"]))) f.close() except (IOError, OSError): # ignore these
--- a/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDataDialog.py Tue Feb 25 19:37:17 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDataDialog.py Wed Feb 26 19:39:29 2014 +0100 @@ -34,11 +34,13 @@ """ Public method to retrieve the entered data. - @return tuple with user's first name, last name, email address and - list of activated extensions (tuple of three strings and a list - of strings) + @return tuple with user's first name, last name, email address, + list of activated extensions and dictionary with extension data + (tuple of three strings, a list of strings and a dictionary with + extension name as key) """ extensions = [] + extensionsData = {} if self.bookmarksCheckBox.isChecked(): extensions.append("bookmarks") @@ -56,10 +58,22 @@ extensions.append("shelve") if self.transplantCheckBox.isChecked(): extensions.append("transplant") + if self.largefilesCheckBox.isChecked(): + extensions.append("largefiles") + largefilesDataDict = {} + lfFileSize = self.lfFileSizeSpinBox.value() + if lfFileSize != 10: # default value is 10 MB + largefilesDataDict["minsize"] = lfFileSize + lfFilePatterns = self.lfFilePatternsEdit.text() + if lfFilePatterns: + largefilesDataDict["patterns"] = lfFilePatterns.split() + if largefilesDataDict: + extensionsData["largefiles"] = largefilesDataDict return ( self.firstNameEdit.text(), self.lastNameEdit.text(), self.emailEdit.text(), extensions, + extensionsData, )
--- a/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDataDialog.ui Tue Feb 25 19:37:17 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDataDialog.ui Wed Feb 26 19:39:29 2014 +0100 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>400</width> - <height>346</height> + <height>388</height> </rect> </property> <property name="windowTitle"> @@ -105,6 +105,16 @@ </widget> </item> <item row="1" column="1"> + <widget class="QCheckBox" name="largefilesCheckBox"> + <property name="toolTip"> + <string>Select to activate the largefiles extension</string> + </property> + <property name="text"> + <string>Large Files</string> + </property> + </widget> + </item> + <item row="2" column="0"> <widget class="QCheckBox" name="purgeCheckBox"> <property name="toolTip"> <string>Select to activate the Purge extension</string> @@ -114,7 +124,7 @@ </property> </widget> </item> - <item row="2" column="0"> + <item row="2" column="1"> <widget class="QCheckBox" name="queuesCheckBox"> <property name="toolTip"> <string>Select to activate the queues extension</string> @@ -124,7 +134,7 @@ </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="0"> <widget class="QCheckBox" name="rebaseCheckBox"> <property name="toolTip"> <string>Select to activate the rebase extension</string> @@ -134,7 +144,7 @@ </property> </widget> </item> - <item row="3" column="0"> + <item row="3" column="1"> <widget class="QCheckBox" name="shelveCheckBox"> <property name="toolTip"> <string>Select to activate the shelve extension</string> @@ -144,7 +154,7 @@ </property> </widget> </item> - <item row="3" column="1"> + <item row="4" column="0"> <widget class="QCheckBox" name="transplantCheckBox"> <property name="toolTip"> <string>Select to activate the transplant extension</string> @@ -158,6 +168,71 @@ </widget> </item> <item> + <widget class="QGroupBox" name="largefilesGroup"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="title"> + <string>Large Files</string> + </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Minimum file size:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="lfFileSizeSpinBox"> + <property name="toolTip"> + <string>Enter the minimum file size in MB for files to be treated as Large Files</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="suffix"> + <string> MB</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>215</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Patterns:</string> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2"> + <widget class="QLineEdit" name="lfFilePatternsEdit"> + <property name="toolTip"> + <string>Enter file patterns (space separated) for files to be treated as Large Files</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -183,11 +258,14 @@ <tabstop>bookmarksCheckBox</tabstop> <tabstop>fetchCheckBox</tabstop> <tabstop>gpgCheckBox</tabstop> + <tabstop>largefilesCheckBox</tabstop> <tabstop>purgeCheckBox</tabstop> <tabstop>queuesCheckBox</tabstop> <tabstop>rebaseCheckBox</tabstop> <tabstop>shelveCheckBox</tabstop> <tabstop>transplantCheckBox</tabstop> + <tabstop>lfFileSizeSpinBox</tabstop> + <tabstop>lfFilePatternsEdit</tabstop> <tabstop>buttonBox</tabstop> </tabstops> <resources/> @@ -199,8 +277,8 @@ <slot>accept()</slot> <hints> <hint type="sourcelabel"> - <x>248</x> - <y>254</y> + <x>257</x> + <y>378</y> </hint> <hint type="destinationlabel"> <x>157</x> @@ -215,8 +293,8 @@ <slot>reject()</slot> <hints> <hint type="sourcelabel"> - <x>316</x> - <y>260</y> + <x>325</x> + <y>378</y> </hint> <hint type="destinationlabel"> <x>286</x> @@ -224,5 +302,21 @@ </hint> </hints> </connection> + <connection> + <sender>largefilesCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>largefilesGroup</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>225</x> + <y>173</y> + </hint> + <hint type="destinationlabel"> + <x>55</x> + <y>276</y> + </hint> + </hints> + </connection> </connections> </ui>
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py Tue Feb 25 19:37:17 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Wed Feb 26 19:39:29 2014 +0100 @@ -2160,10 +2160,11 @@ from .HgUserConfigDataDialog import HgUserConfigDataDialog dlg = HgUserConfigDataDialog(version=self.version) if dlg.exec_() == QDialog.Accepted: - firstName, lastName, email, extensions = dlg.getData() + firstName, lastName, email, extensions, extensionsData = \ + dlg.getData() else: - firstName, lastName, email, extensions = ( - "Firstname", "Lastname", "email_address", []) + firstName, lastName, email, extensions, extensionsData = ( + "Firstname", "Lastname", "email_address", [], {}) try: f = open(cfgFile, "w") f.write("[ui]\n") @@ -2173,6 +2174,15 @@ f.write("\n[extensions]\n") f.write(" =\n".join(extensions)) f.write(" =\n") # complete the last line + if "largefiles" in extensionsData: + dataDict = extensionsData["largefiles"] + f.write("\n[largefiles]\n") + if "minsize" in dataDict: + f.write("minsize = {0}\n".format(dataDict["minsize"])) + if "patterns" in dataDict: + f.write("patterns =\n") + f.write(" {0}\n".format( + "\n ".join(dataDict["patterns"]))) f.close() except (IOError, OSError): # ignore these