by
Changes to 12 files · Browse files at e8ec5fd78cf5 Showing diff from parent 198b2599029e d887c7ccf021 Diff from another changeset...
@@ -29,12 +29,15 @@ self.ui = ui.ui()
self.ret = None
- dest = src = cwd = hglib.tounicode(os.getcwd())
+ dest = src = cwd = os.getcwd()
if len(args) > 1:
src = args[0]
dest = args[1]
elif len(args):
src = args[0]
+ udest = hglib.tounicode(dest)
+ usrc = hglib.tounicode(src)
+ ucwd = hglib.tounicode(cwd)
# base layout box
box = QVBoxLayout()
@@ -80,12 +83,12 @@ self.shist = s.value('clone/source').toStringList()
for path in self.shist:
if path: self.src_combo.addItem(path)
- self.src_combo.setEditText(src)
+ self.src_combo.setEditText(usrc)
self.dhist = s.value('clone/dest').toStringList()
for path in self.dhist:
if path: self.dest_combo.addItem(path)
- self.dest_combo.setEditText(dest)
+ self.dest_combo.setEditText(udest)
### options
expander = qtlib.ExpanderLabel(_('Options'), False)
@@ -162,7 +165,7 @@ # dialog setting
self.setLayout(box)
self.layout().setSizeConstraint(QLayout.SetFixedSize)
- self.setWindowTitle(_('Clone - %s') % cwd)
+ self.setWindowTitle(_('Clone - %s') % ucwd)
self.setWindowIcon(qtlib.geticon('hg-clone'))
# prepare to show
|
|
|
@@ -203,20 +203,23 @@ hbox = QHBoxLayout()
hbox.setMargin(0)
hbox.setContentsMargins(*(0,)*4)
+ tbar = QToolBar(_("Commit Dialog Toolbar"), self)
+ hbox.addWidget(tbar)
- msgcombo = MessageHistoryCombo()
- msgcombo.activated.connect(self.msgSelected)
- hbox.addWidget(msgcombo, 1)
+ self.recentMessagesButton = QToolButton(
+ text=_('Copy message'),
+ popupMode=QToolButton.InstantPopup,
+ statusTip=_('Copy one of the recent commit messages'))
+ tbar.addWidget(self.recentMessagesButton)
+ self.updateRecentMessages()
- branchbutton = QPushButton(_('Branch: '))
- branchbutton.pressed.connect(self.branchOp)
- self.branchbutton = branchbutton
+ self.branchbutton = tbar.addAction(_('Branch: '))
+ self.branchbutton.triggered.connect(self.branchOp)
self.branchop = None
- hbox.addWidget(branchbutton)
- self.detailsbutton = QPushButton(_('Options'))
- self.detailsbutton.pressed.connect(self.details)
- hbox.addWidget(self.detailsbutton)
+ tbar.addAction(_('Options')).triggered.connect(self.details)
+
+ hbox.addStretch(1)
vbox.addLayout(hbox, 0)
self.buttonHBox = hbox
@@ -249,7 +252,6 @@ # add our splitter where the docf used to be
self.stwidget.split.addWidget(self.split)
self.msgte = msgte
- self.msgcombo = msgcombo
QShortcut(QKeySequence('Ctrl+Return'), self, self.commit)
@pyqtSlot(QString, QString)
@@ -322,9 +324,6 @@ self.commitButtonEnable.emit(not ispatch)
self.msgte.refresh(self.repo)
- # Update message list
- self.msgcombo.reset(self.msghistory)
-
# Update branch operation button
branchu = hglib.tounicode(self.repo[None].branch())
if self.branchop is None:
@@ -373,6 +372,15 @@ self.reload()
QTimer.singleShot(500, lambda: shlib.shell_notify([self.repo.root]))
+ def updateRecentMessages(self):
+ # Define a menu that lists recent messages
+ m = QMenu()
+ for s in self.msghistory:
+ title = s.split('\n', 1)[0][:70]
+ def overwriteMsg(newMsg): return lambda: self.msgSelected(newMsg)
+ m.addAction(title).triggered.connect(overwriteMsg(s))
+ self.recentMessagesButton.setMenu(m)
+
def getMessage(self):
text = self.msgte.text()
try:
@@ -381,14 +389,14 @@ pass # TODO
return text
- def msgSelected(self, index):
+ def msgSelected(self, message):
if self.msgte.text() and self.msgte.isModified():
d = QMessageBox.question(self, _('Confirm Discard Message'),
_('Discard current commit message?'),
QMessageBox.Ok | QMessageBox.Cancel)
if d != QMessageBox.Ok:
return
- self.setMessage(self.msghistory[index])
+ self.setMessage(message)
self.msgte.setFocus()
def setMessage(self, msg):
@@ -412,7 +420,7 @@ self.stwidget.loadSettings(s, lpref+'status')
self.msghistory = list(s.value(gpref+'history-'+repoid).toStringList())
self.msghistory = [m for m in self.msghistory if m]
- self.msgcombo.reset(self.msghistory)
+ self.updateRecentMessages()
self.userhist = s.value(gpref+'userhist').toStringList()
self.userhist = [u for u in self.userhist if u]
try:
@@ -448,6 +456,7 @@ self.msghistory.remove(umsg)
self.msghistory.insert(0, umsg)
self.msghistory = self.msghistory[:10]
+ self.updateRecentMessages()
def addUsernameToHistory(self, user):
if user in self.userhist:
@@ -610,26 +619,6 @@ self.commitComplete.emit()
self.stwidget.refreshWctx()
-class MessageHistoryCombo(QComboBox):
- def __init__(self, parent=None):
- QComboBox.__init__(self, parent)
- self.reset([])
-
- def reset(self, msgs):
- self.clear()
- self.addItem(_('Recent commit messages...'))
- self.loaded = False
- self.msgs = msgs
-
- def showPopup(self):
- if not self.loaded:
- self.clear()
- for s in self.msgs:
- self.addItem(s.split('\n', 1)[0][:70])
- self.loaded = True
- QComboBox.showPopup(self)
-
-
class DetailsDialog(QDialog):
'Utility dialog for configuring uncommon settings'
def __init__(self, opts, userhistory, parent):
@@ -646,6 +635,8 @@ usercombo = QComboBox()
usercombo.setEditable(True)
usercombo.setEnabled(False)
+ SP = QSizePolicy
+ usercombo.setSizePolicy(SP(SP.Expanding, SP.Minimum))
self.usercb.toggled.connect(usercombo.setEnabled)
self.usercb.toggled.connect(lambda s: s and usercombo.setFocus())
|
@@ -677,7 +677,7 @@ else:
return
- self.olddata = olddata
+ self.olddata = hglib.tounicode(olddata)
newdate = util.datestr(ctx.date())
olddate = util.datestr(ctx2.date())
revs = [str(ctx), str(ctx2)]
|
@@ -30,8 +30,7 @@ (Passed as `hg email --bundle --rev {rev}`)
"""
super(EmailDialog, self).__init__(parent)
- self.setWindowFlags((self.windowFlags() | Qt.WindowMinimizeButtonHint)
- & ~Qt.WindowContextHelpButtonHint)
+ self.setWindowFlags(Qt.Window)
self._repo = repo
self._outgoing = outgoing
self._outgoingrevs = outgoingrevs or []
|
@@ -193,26 +193,26 @@
self._actions = {}
for name, desc, icon, key, tip, cb in [
- ('navigate', _('File history'), None, 'Shift+Return',
+ ('navigate', _('File history'), 'hg-log', 'Shift+Return',
_('Show the history of the selected file'), self.navigate),
- ('diffnavigate', _('Compare file revisions'), None, None,
+ ('diffnavigate', _('Compare file revisions'), 'compare-files', None,
_('Compare revisions of the selected file'), self.diffNavigate),
- ('diff', _('Visual Diff'), None, 'Ctrl+D',
+ ('diff', _('Visual Diff'), 'visualdiff', 'Ctrl+D',
_('View file changes in external diff tool'), self.vdiff),
- ('ldiff', _('Visual Diff to Local'), None, 'Shift+Ctrl+D',
+ ('ldiff', _('Visual Diff to Local'), 'ldiff', 'Shift+Ctrl+D',
_('View changes to current in external diff tool'),
self.vdifflocal),
- ('edit', _('View at Revision'), None, 'Alt+Ctrl+E',
+ ('edit', _('View at Revision'), 'view-at-revision', 'Alt+Ctrl+E',
_('View file as it appeared at this revision'), self.editfile),
- ('ledit', _('Edit Local'), None, 'Shift+Ctrl+E',
+ ('ledit', _('Edit Local'), 'edit-file', 'Shift+Ctrl+E',
_('Edit current file in working copy'), self.editlocal),
- ('revert', _('Revert to Revision'), None, 'Alt+Ctrl+T',
+ ('revert', _('Revert to Revision'), 'hg-revert', 'Alt+Ctrl+T',
_('Revert file(s) to contents at this revision'),
self.revertfile),
]:
act = QAction(desc, self)
if icon:
- act.setIcon(geticon(icon))
+ act.setIcon(qtlib.getmenuicon(icon))
if key:
act.setShortcut(key)
if tip:
@@ -317,7 +317,13 @@ self._treemodel = ManifestModel(self._repo, self._rev,
statusfilter=self._statusfilter.status(),
parent=self)
+ oldmodel = self._treeview.model()
+ oldselmodel = self._treeview.selectionModel()
self._treeview.setModel(self._treemodel)
+ if oldmodel:
+ oldmodel.deleteLater()
+ if oldselmodel:
+ oldselmodel.deleteLater()
selmodel = self._treeview.selectionModel()
selmodel.currentChanged.connect(self._updatecontent)
|
@@ -737,6 +737,9 @@
### Override Method ###
+ def reject(self):
+ pass
+
def repositoryChanged(self):
'repository has detected a change to changelog or parents'
pass
|
@@ -198,7 +198,7 @@ self.setAcceptDrops(True)
if hasattr(self.patchNameLE, 'setPlaceholderText'): # Qt >= 4.7
- self.patchNameLE.setPlaceholderText('### patch name ###')
+ self.patchNameLE.setPlaceholderText(_('### patch name ###'))
if parent:
self.layout().setContentsMargins(2, 2, 2, 2)
@@ -461,7 +461,7 @@ self.messageEditor.setFocus()
def setMessage(self, message):
- self.messageEditor.setText(message)
+ self.messageEditor.setText(message) # message: unicode
lines = self.messageEditor.lines()
if lines:
lines -= 1
@@ -625,7 +625,7 @@ self.messages = []
for patch in repo.mq.series:
ctx = repo.changectx(patch)
- msg = ctx.description()
+ msg = hglib.tounicode(ctx.description())
if msg:
self.messages.append((patch, msg))
self.msgSelectCombo.reset(self.messages)
@@ -651,7 +651,7 @@ self.msgSelectCombo.setEnabled(True)
self.qnewOrRefreshBtn.setEnabled(True)
if not newmode:
- self.setMessage(pctx.description())
+ self.setMessage(hglib.tounicode(pctx.description()))
name = repo.mq.applied[-1].name
self.patchNameLE.setText(hglib.tounicode(name))
else:
@@ -681,7 +681,7 @@ pctx = self.repo.changectx('.')
if 'qtip' in pctx.tags():
self.messageEditor.setEnabled(True)
- self.setMessage(pctx.description())
+ self.setMessage(hglib.tounicode(pctx.description()))
name = self.repo.mq.applied[-1].name
self.patchNameLE.setText(hglib.tounicode(name))
self.qnewOrRefreshBtn.setEnabled(True)
|
@@ -286,7 +286,7 @@ def setBundle(self, bfile):
if self.bundle:
self.clearBundle()
- self.bundle = unicode(bfile)
+ self.bundle = hglib.fromunicode(bfile)
oldlen = len(self.repo)
self.repo = thgrepo.repository(self.repo.ui, self.repo.root,
bundle=self.bundle)
@@ -592,14 +592,17 @@ self.showMessage('')
if self.repomodel.graph is None:
return
- if type(rev) != str: # unapplied patch
- self.manifestDemand.forward('setRev', rev)
- self.grepDemand.forward('setRevision', rev)
- self.syncDemand.forward('refreshTargets', rev)
- else:
- self.manifestDemand.forward('setRev', None)
- self.revDetailsWidget.onRevisionSelected(rev)
- self.revisionSelected.emit(rev)
+ try:
+ self.revDetailsWidget.onRevisionSelected(rev)
+ self.revisionSelected.emit(rev)
+ if type(rev) != str: # unapplied patch
+ self.manifestDemand.forward('setRev', rev)
+ self.grepDemand.forward('setRevision', rev)
+ self.syncDemand.forward('refreshTargets', rev)
+ else:
+ self.manifestDemand.forward('setRev', None)
+ except (IndexError, error.RevlogError, error.Abort), e:
+ self.showMessage(hglib.tounicode(str(e)))
def gotoParent(self):
self.repoview.clearSelection()
@@ -1254,7 +1257,7 @@ traceback.print_exc()
return
output = _ui.popbuffer()
- QApplication.clipboard().setText(output)
+ QApplication.clipboard().setText(hglib.tounicode(output))
def copyHash(self):
clip = QApplication.clipboard()
|
@@ -289,9 +289,19 @@ if options['quiet']:
ui.quiet = True
- if cmd not in nonrepo_commands.split() and not path:
- raise error.RepoError(_("There is no Mercurial repository here"
- " (.hg not found)"))
+ if cmd not in nonrepo_commands.split():
+ if not path:
+ raise error.RepoError(_("There is no Mercurial repository here"
+ " (.hg not found)"))
+ try:
+ # Ensure we can open the repository before opening any dialog
+ # windows. Since thgrepo instances are cached, this is not wasted.
+ from tortoisehg.hgqt import thgrepo
+ repo = thgrepo.repository(lui, path)
+ except error.RepoError, e:
+ qtlib.WarningMsgBox(_('Repository Error'),
+ hglib.tounicode(str(e)))
+ raise
cmdoptions['mainapp'] = True
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
|
@@ -544,6 +544,19 @@ ({'name': 'extensions', 'label': _('Extensions'), 'icon': 'hg-extensions'}, (
)),
+({'name': 'issue', 'label': _('Issue Tracking'), 'icon': 'edit-file'}, (
+ _fi(_('Issue Regex'), 'tortoisehg.issue.regex', genEditCombo,
+ _('Defines the regex to match when picking up issue numbers.')),
+ _fi(_('Issue Link'), 'tortoisehg.issue.link', genEditCombo,
+ _('Defines the command to run when an issue number is recognized. '
+ 'You may include groups in issue.regex, and corresponding {n} '
+ 'tokens in issue.link (where n is a non-negative integer). '
+ '{0} refers to the entire string matched by issue.regex, '
+ 'while {1} refers to the first group and so on. If no {n} tokens'
+ 'are found in issue.link, the entire matched string is appended '
+ 'instead.')),
+ )),
+
({'name': 'reviewboard', 'label': _('Review Board'), 'icon': 'reviewboard'}, (
_fi(_('Server'), 'reviewboard.server', genEditCombo,
_('Path to review board'
|
@@ -34,9 +34,13 @@ if user.find(':') != -1:
user, passwd = tuple(user.split(':'))
m = re.match(r'([^:/]+)(:(\d+))?(/(.*))?$', p)
- host = m.group(1)
- port = m.group(3)
- folder = m.group(5) or '.'
+ if m:
+ host = m.group(1)
+ port = m.group(3)
+ folder = m.group(5) or '.'
+ else:
+ qtlib.WarningMsgBox(_('Malformed ssh URL'), hglib.tounicode(path))
+ host, port, folder = '', '', ''
elif path.startswith('http://') or path.startswith('https://'):
snpaqf = urlparse.urlparse(path)
scheme, netloc, folder, params, query, fragment = snpaqf
@@ -259,10 +263,11 @@
def refreshStatusTips(self):
url = self.currentUrl(True)
- self.incomingAction.setStatusTip(_('Preview incoming changesets from %s') % url)
- self.pullAction.setStatusTip(_('Pull incoming changesets from %s') % url)
- self.outgoingAction.setStatusTip(_('Filter outgoing changesets to %s') % url)
- self.pushAction.setStatusTip(_('Push outgoing changesets to %s') % url)
+ urlu = hglib.tounicode(url)
+ self.incomingAction.setStatusTip(_('Preview incoming changesets from %s') % urlu)
+ self.pullAction.setStatusTip(_('Pull incoming changesets from %s') % urlu)
+ self.outgoingAction.setStatusTip(_('Filter outgoing changesets to %s') % urlu)
+ self.pushAction.setStatusTip(_('Push outgoing changesets to %s') % urlu)
def loadTargets(self, ctx):
self.targetcombo.clear()
|
@@ -146,7 +146,7 @@ traceback.print_exc()
return
output = ui.popbuffer()
- QApplication.clipboard().setText(output)
+ QApplication.clipboard().setText(hglib.tounicode(output))
def vdiff(parent, ui, repo, files):
dlg = visdiff.visualdiff(ui, repo, files, {})
|
Loading...