337 UI.PixmapCache.getIcon("fileDelete.png"), |
337 UI.PixmapCache.getIcon("fileDelete.png"), |
338 self.tr("Strip Changesets"), self.__stripActTriggered) |
338 self.tr("Strip Changesets"), self.__stripActTriggered) |
339 self.__stripAct.setToolTip(self.tr( |
339 self.__stripAct.setToolTip(self.tr( |
340 "Strip changesets from a repository")) |
340 "Strip changesets from a repository")) |
341 |
341 |
|
342 self.__actionsMenu.addSeparator() |
|
343 |
|
344 self.__selectAllAct = self.__actionsMenu.addAction( |
|
345 self.tr("Select All Entries"), self.__selectAllActTriggered) |
|
346 self.__unselectAllAct = self.__actionsMenu.addAction( |
|
347 self.tr("Deselect All Entries"), |
|
348 lambda: self.__selectAllActTriggered(False)) |
|
349 |
342 self.actionsButton.setIcon( |
350 self.actionsButton.setIcon( |
343 UI.PixmapCache.getIcon("actionsToolButton.png")) |
351 UI.PixmapCache.getIcon("actionsToolButton.png")) |
344 self.actionsButton.setMenu(self.__actionsMenu) |
352 self.actionsButton.setMenu(self.__actionsMenu) |
345 |
353 |
346 # TODO: add action "Create Changegroup" (>=1 revs, lowest rev is base) |
|
347 # TODO: add action "Sign Revision" (>= 1 revs) (GPG extension) |
354 # TODO: add action "Sign Revision" (>= 1 revs) (GPG extension) |
348 # TODO: add action "Verify Signature" (1 rev) (GPG extension) |
355 # TODO: add action "Verify Signature" (1 rev) (GPG extension) |
349 |
356 |
350 def __initData(self): |
357 def __initData(self): |
351 """ |
358 """ |
2158 def __bundleActTriggered(self): |
2165 def __bundleActTriggered(self): |
2159 """ |
2166 """ |
2160 Private slot to create a changegroup file. |
2167 Private slot to create a changegroup file. |
2161 """ |
2168 """ |
2162 if self.initialCommandMode == "log": |
2169 if self.initialCommandMode == "log": |
2163 # TODO: implement bundle |
2170 selectedItems = self.logTree.selectedItems() |
2164 pass |
2171 if len(selectedItems) == 0: |
|
2172 # all revisions of the local repository will be bundled |
|
2173 bundleData = { |
|
2174 "revs": [], |
|
2175 "base": "", |
|
2176 "all": True, |
|
2177 } |
|
2178 elif len(selectedItems) == 1: |
|
2179 # the selected changeset is the base |
|
2180 rev = selectedItems[0].text(self.RevisionColumn)\ |
|
2181 .split(":", 1)[0].strip() |
|
2182 bundleData = { |
|
2183 "revs": [], |
|
2184 "base": rev, |
|
2185 "all": False, |
|
2186 } |
|
2187 else: |
|
2188 # lowest revision is the base, others will be bundled |
|
2189 revs = [] |
|
2190 for itm in selectedItems: |
|
2191 rev = itm.text(self.RevisionColumn).split(":", 1)[0] |
|
2192 try: |
|
2193 revs.append(int(rev)) |
|
2194 except ValueError: |
|
2195 # ignore silently |
|
2196 pass |
|
2197 baseRev = min(revs) |
|
2198 while baseRev in revs: |
|
2199 revs.remove(baseRev) |
|
2200 |
|
2201 bundleData = { |
|
2202 "revs": [str(rev) for rev in revs], |
|
2203 "base": str(baseRev), |
|
2204 "all": False, |
|
2205 } |
2165 elif self.initialCommandMode == "outgoing": |
2206 elif self.initialCommandMode == "outgoing": |
2166 # TODO: implement bundle for outgoing mode |
2207 # TODO: implement bundle for outgoing mode |
2167 pass |
2208 pass |
|
2209 |
|
2210 self.vcs.hgBundle(self.repodir, bundleData=bundleData) |
|
2211 |
|
2212 def __selectAllActTriggered(self, select=True): |
|
2213 """ |
|
2214 Private method to select or unselect all log entries. |
|
2215 |
|
2216 @param select flag indicating to select all entries |
|
2217 @type bool |
|
2218 """ |
|
2219 blocked = self.logTree.blockSignals(True) |
|
2220 for row in range(self.logTree.topLevelItemCount()): |
|
2221 self.logTree.topLevelItem(row).setSelected(select) |
|
2222 self.logTree.blockSignals(blocked) |
|
2223 self.on_logTree_itemSelectionChanged() |
2168 |
2224 |
2169 def __actionMode(self): |
2225 def __actionMode(self): |
2170 """ |
2226 """ |
2171 Private method to get the selected action mode. |
2227 Private method to get the selected action mode. |
2172 |
2228 |