Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
# qreorder.py - reorder unapplied MQ patches## Copyright 2010 Steve Borho <steve@borho.org>## This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.importosfromhgextimportmqfromtortoisehg.hgqtimportqtlib,thgrepo,qrenamefromtortoisehg.utilimporthglib,pathsfromtortoisehg.hgqt.i18nimport_fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*# TODO:# This approach will nuke any user configured guards# Explicit refreshclassQReorderDialog(QDialog):def__init__(self,repo,parent=None):QDialog.__init__(self,parent)self.setWindowTitle(_('Reorder Unapplied Patches'))self.setWindowFlags(Qt.Window)self.setWindowIcon(qtlib.geticon('hg-qreorder'))self.repo=repoself.cached=Nonerepo.repositoryChanged.connect(self.refresh)layout=QVBoxLayout()layout.setMargin(4)self.setLayout(layout)hb=QHBoxLayout()hb.setMargin(2)lbl=QLabel(_('Repository:'))hb.addWidget(lbl)le=QLineEdit()hb.addWidget(le)le.setReadOnly(True)le.setFont(qtlib.getfont('fontlist').font())le.setText(repo.displayname)le.setFocusPolicy(Qt.NoFocus)layout.addLayout(hb)hl=qtlib.LabeledSeparator('')layout.addWidget(hl)classPatchListWidget(QListWidget):menuRequested=pyqtSignal(QPoint,object)def__init__(self,parent):QListWidget.__init__(self,parent)self.setCurrentRow(0)defcontextMenuEvent(self,event):self.menuRequested.emit(event.globalPos(),hglib.fromunicode(self.item(self.currentRow()).text()))deffocusInEvent(self,e):i=self.item(self.currentRow())ifi:self.parent().parent().showSummary(i)QListWidget.focusInEvent(self,e)ugb=QGroupBox(_('Unapplied Patches - drag to reorder'))ugb.setLayout(QVBoxLayout())ugb.layout().setContentsMargins(*(0,)*4)self.ulw=PatchListWidget(self)self.ulw.setDragDropMode(QListView.InternalMove)ugb.layout().addWidget(self.ulw)self.ulw.currentItemChanged.connect(lambda:self.showSummary(self.ulw.item(self.ulw.currentRow())))self.ulw.menuRequested.connect(self.patchlistMenuRequest)layout.addWidget(ugb)agb=QGroupBox(_('Applied Patches'))agb.setLayout(QVBoxLayout())agb.layout().setContentsMargins(*(0,)*4)self.alw=PatchListWidget(self)agb.layout().addWidget(self.alw)self.alw.currentItemChanged.connect(lambda:self.showSummary(self.alw.item(self.alw.currentRow())))self.alw.menuRequested.connect(self.patchlistMenuRequest)layout.addWidget(agb)slbl=QLabel(_('Summary:'))layout.addWidget(slbl)self.summ=QTextEdit()self.summ.setFont(qtlib.getfont('fontcomment').font())self.summ.setMinimumWidth(500)# min 80 charsself.summ.setMaximumHeight(100)self.summ.setReadOnly(True)self.summ.setFocusPolicy(Qt.NoFocus)layout.addWidget(self.summ)self._readsettings()self.refresh()# dialog buttonsBB=QDialogButtonBoxbb=QDialogButtonBox(BB.Ok|BB.Cancel)self.apply_button=bb.button(BB.Apply)bb.accepted.connect(self.accept)bb.rejected.connect(self.reject)bb.button(BB.Ok).setDefault(True)layout.addWidget(bb)self.alw.setCurrentRow(0)self.ulw.setCurrentRow(0)self.ulw.setFocus()defpatchlistMenuRequest(self,point,selection):self.menuselection=selectionmenu=QMenu(self)act=QAction(_('Rename patch'),self)act.triggered.connect(self.qrenamePatch)menu.addAction(act)menu.exec_(point)defqrenamePatch(self):patchname=self.menuselectiondlg=qrename.QRenameDialog(self.repo,patchname,self)dlg.finished.connect(dlg.deleteLater)dlg.output.connect(self.parent().output)dlg.makeLogVisible.connect(self.parent().makeLogVisible)dlg.exec_()defrefresh(self):patchnames=self.repo.mq.series[:]applied=[p.nameforpinself.repo.mq.applied]if(patchnames,applied)==self.cached:returnalw,ulw=self.alw,self.ulwifself.cached:ifapplied!=self.cached[1]:cw=alwelse:cw=ulwelse:cw=ulwar=alw.currentRow()ur=ulw.currentRow() ulw.clear()
alw.clear()
for p in reversed(patchnames):
- item = QListWidgetItem(hglib.tounicode(p))+ # Each row in the patch list has the+ # format [patchname] patchdescription+ # The patch description is the first line of the patch message+ # If the message has more than one line, we add "..." to the first+ # line to create the patch description+ patchmessage = mq.patchheader(self.repo.mq.join(p)).message+ patchdesc = patchmessage[0]+ if len(patchmessage) > 1:+ patchdesc = patchdesc + '...'+ item = QListWidgetItem('[%s]\t%s' % (hglib.tounicode(p), hglib.tounicode(patchdesc)))+ # Save the patchname with the item so that we can easily+ # retrieve it later+ item.patchname = p+ if p in applied:
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
item.setForeground(QColor(111,111,111)) # gray, like disabled
alw.addItem(item)else:item.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled|Qt.ItemIsDragEnabled)ulw.addItem(item)self.cached=patchnames,appliedifcw==ulw:alw.setCurrentRow(ar)ulw.setCurrentRow(ur)self.ulw.setFocus()else:ulw.setCurrentRow(ur)alw.setCurrentRow(ar)self.alw.setFocus() def showSummary(self, item):
try:
- patchname =hglib.fromunicode(item.text())- txt = '\n'.join(mq.patchheader(self.repo.mq.join(patchname)).message)
+# Note that item.patchname usesthe local encoding and hence does+ # not need to be converted from unicode+ txt = '\n'.join(mq.patchheader(self.repo.mq.join(item.patchname)).message)
self.summ.setText(hglib.tounicode(txt))
except:
pass
defaccept(self):self._writesettings()try:self.repo.incrementBusyCount() lines = []
for i in xrange(self.alw.count()-1, -1, -1):
item = self.alw.item(i)
- lines.append(hglib.fromunicode(item.text()))
+ lines.append(item.patchname)
for i in xrange(self.ulw.count()-1, -1, -1):
item = self.ulw.item(i)
- lines.append(hglib.fromunicode(item.text()))
+ lines.append(item.patchname)
if lines:
fp = self.repo.mq.opener('series', 'wb')
fp.write('\n'.join(lines))
fp.close()finally:self.repo.decrementBusyCount()QDialog.accept(self)defreject(self):QDialog.reject(self)defcloseEvent(self,event):self._writesettings()super(QReorderDialog,self).closeEvent(event)def_readsettings(self):s=QSettings()self.restoreGeometry(s.value('qreorder/geom').toByteArray())def_writesettings(self):s=QSettings()s.setValue('qreorder/geom',self.saveGeometry())defrun(ui,*pats,**opts):repo=thgrepo.repository(None,paths.find_root())ifhasattr(repo,'mq'):returnQReorderDialog(repo)else:qtlib.ErrorMsgBox(_('TortoiseHg Error'),_('Please enable the MQ extension first.'))
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.