by
Changes to 31 files · Browse files at 291f63059ff4 Showing diff from parent d9a487705a3f 6fb8c70dd82e Diff from another changeset...
@@ -55,10 +55,10 @@
self.set_website("http://bitbucket.org/tortoisehg/stable/")
self.set_name("TortoiseHg")
- self.set_version("(version %s)" % version.version())
+ self.set_version(_("(version %s)") % version.version())
if hasattr(self, 'set_wrap_license'):
self.set_wrap_license(True)
- self.set_copyright("Copyright 2009 TK Soh and others")
+ self.set_copyright(_("Copyright 2009 TK Soh and others"))
thg_logo = paths.get_tortoise_icon('thg_logo_92x50.png')
thg_icon = paths.get_tortoise_icon('thg_logo.ico')
@@ -74,7 +74,7 @@ license = hgtk.shortlicense.splitlines()[1:]
self.set_license('\n'.join(license))
- self.set_comments("with " + lib_versions + "\n\n" + comment)
+ self.set_comments(_("with %s") % lib_versions + "\n\n" + comment)
self.set_logo(gtk.gdk.pixbuf_new_from_file(thg_logo))
self.set_icon_from_file(thg_icon)
self.connect('response', self.response)
|
|
|
@@ -0,0 +1,210 @@ + # archive.py - TortoiseHg's dialog for archiving a repo revision
+#
+# Copyright 2009 Emmanuel Rosa <goaway1000@gmail.com>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2, incorporated herein by reference.
+
+import os
+import gtk
+import gobject
+import pango
+
+from mercurial import hg, ui
+
+from thgutil.i18n import _
+from thgutil import hglib, paths
+
+from hggtk import hgcmd, gtklib
+
+_working_dir_parent_ = _('= Working Directory Parent =')
+
+class ArchiveDialog(gtk.Window):
+ """ Dialog to archive a Mercurial repo """
+ def __init__(self, rev=None):
+ """ Initialize the Dialog """
+ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+ gtklib.set_tortoise_icon(self, 'menucheckout.ico')
+ gtklib.set_tortoise_keys(self)
+
+ self.set_default_size(550, 120)
+ self.notify_func = None
+
+ try:
+ repo = hg.repository(ui.ui(), path=paths.find_root())
+ except hglib.RepoError:
+ gobject.idle_add(self.destroy)
+ return
+
+ title = _('Archive - %s') % hglib.toutf(os.path.basename(repo.root))
+ self.set_title(title)
+
+ vbox = gtk.VBox()
+ self.add(vbox)
+
+ hbox = gtk.HBox()
+ lbl = gtk.Label(_('Archive revision:'))
+ hbox.pack_start(lbl, False, False, 2)
+
+ # revisions editable combo box
+ combo = gtk.combo_box_entry_new_text()
+ hbox.pack_start(combo, True, True, 2)
+ vbox.pack_start(hbox, False, False, 10)
+ if rev:
+ combo.append_text(str(rev))
+ else:
+ combo.append_text(_working_dir_parent_)
+ combo.set_active(0)
+ for b in repo.branchtags():
+ combo.append_text(b)
+ tags = list(repo.tags())
+ tags.sort()
+ tags.reverse()
+ for t in tags:
+ combo.append_text(t)
+
+ vbox.add(self.get_destination_container(self.get_default_path()))
+ vbox.add(self.get_type_container())
+
+ hbbox = gtk.HButtonBox()
+ hbbox.set_layout(gtk.BUTTONBOX_END)
+ vbox.pack_start(hbbox, False, False, 2)
+ close = gtk.Button(_('Close'))
+ close.connect('clicked', lambda x: self.destroy())
+
+ accelgroup = gtk.AccelGroup()
+ self.add_accel_group(accelgroup)
+ key, modifier = gtk.accelerator_parse('Escape')
+ close.add_accelerator('clicked', accelgroup, key, 0,
+ gtk.ACCEL_VISIBLE)
+ hbbox.add(close)
+
+ archive = gtk.Button(_('Archive'))
+ archive.connect('clicked', self.archive, combo, repo)
+ mod = gtklib.get_thg_modifier()
+ key, modifier = gtk.accelerator_parse(mod+'Return')
+ archive.add_accelerator('clicked', accelgroup, key, modifier,
+ gtk.ACCEL_VISIBLE)
+ hbbox.add(archive)
+ archive.grab_focus()
+
+ entry = combo.child
+ entry.connect('activate', self.entry_activated, archive, combo, repo)
+
+ def get_type_container(self):
+ """Return a frame containing the supported archive types"""
+ frame = gtk.Frame(_('Archive type'))
+ vbox = gtk.VBox()
+
+ self.filesradio = gtk.RadioButton(None, _('Directory of files'))
+ self.tarradio = gtk.RadioButton(self.filesradio, _('Uncompressed tar archive'))
+ self.tbz2radio = gtk.RadioButton(self.filesradio, _('Tar archive compressed using bzip2'))
+ self.tgzradio = gtk.RadioButton(self.filesradio, _('Tar archive compressed using gzip'))
+ self.uzipradio = gtk.RadioButton(self.filesradio, _('Uncompressed zip archive'))
+ self.zipradio = gtk.RadioButton(self.filesradio, _('Zip archive compressed using deflate'))
+
+ vbox.pack_start(self.filesradio, True, True, 2)
+ vbox.pack_start(self.tarradio, True, True, 2)
+ vbox.pack_start(self.tbz2radio, True, True, 2)
+ vbox.pack_start(self.tgzradio, True, True, 2)
+ vbox.pack_start(self.uzipradio, True, True, 2)
+ vbox.pack_start(self.zipradio, True, True, 2)
+ frame.add(vbox)
+ frame.set_border_width(2)
+ return frame
+
+ def get_destination_container(self, default_path):
+ """Return an hbox containing the widgets for the destination path"""
+ hbox = gtk.HBox()
+ lbl = gtk.Label(_('Destination Path:'))
+
+ # create drop-down list for source paths
+ self.destlist = gtk.ListStore(str)
+ destcombo = gtk.ComboBoxEntry(self.destlist, 0)
+ self.destentry = destcombo.get_child()
+ self.destentry.set_text(default_path)
+ self.destentry.set_position(-1)
+
+ # replace the drop-down widget so we can modify it's properties
+ destcombo.clear()
+ cell = gtk.CellRendererText()
+ cell.set_property('ellipsize', pango.ELLIPSIZE_MIDDLE)
+ destcombo.pack_start(cell)
+ destcombo.add_attribute(cell, 'text', 0)
+
+ destbrowse = gtk.Button(_('Browse...'))
+ destbrowse.connect('clicked', self.browse_clicked)
+ hbox.pack_start(lbl, False, False)
+ hbox.pack_start(destcombo, True, True, 2)
+ hbox.pack_end(destbrowse, False, False, 5)
+ return hbox
+
+ def get_default_path(self):
+ """Return the default destination path"""
+ return hglib.toutf(os.getcwd())
+
+ def get_save_file_dialog(self, filter):
+ """Return a configured save file dialog"""
+ return gtklib.NativeSaveFileDialogWrapper(
+ InitialDir=self.destentry.get_text(),
+ Title=_('Select Destination File'),
+ Filter=filter)
+
+ def get_selected_archive_type(self):
+ """Return a dictionary describing the selected archive type"""
+ dict = {}
+ if self.tarradio.get_active():
+ dict['type'] = 'tar'
+ dict['filter'] = ((_('Tar archives'), '*.tar'),)
+ elif self.tbz2radio.get_active():
+ dict['type'] = 'tbz2'
+ dict['filter'] = ((_('Bzip2 tar archives'), '*.tbz2'),)
+ elif self.tgzradio.get_active():
+ dict['type'] = 'tgz'
+ dict['filter'] = ((_('Gzip tar archives'), '*.tgz'),)
+ elif self.uzipradio.get_active():
+ dict['type'] = 'uzip'
+ dict['filter'] = ((_('Uncompressed zip archives'), '*.uzip'),)
+ elif self.zipradio.get_active():
+ dict['type'] = 'zip'
+ dict['filter'] = ((_('Compressed zip archives'), '*.zip'),)
+ else:
+ dict['type'] = 'files'
+
+ return dict
+
+ def entry_activated(self, entry, button, combo, repo):
+ self.update(button, combo, repo)
+
+ def browse_clicked(self, button):
+ """Select the destination directory or file"""
+ archive_type = self.get_selected_archive_type()
+ if archive_type['type'] == 'files':
+ response = gtklib.NativeFolderSelectDialog(
+ initial=self.destentry.get_text(),
+ title=_('Select Destination Folder')).run()
+ else:
+ filter = archive_type['filter']
+ response = self.get_save_file_dialog(filter).run()
+
+ if response:
+ self.destentry.set_text(response)
+
+ def archive(self, button, combo, repo):
+ rev = combo.get_active_text()
+
+ cmdline = ['hg', 'archive', '--verbose']
+ if rev != _working_dir_parent_:
+ cmdline.append('--rev')
+ cmdline.append(rev)
+
+ cmdline.append('-t')
+ cmdline.append(self.get_selected_archive_type()['type'])
+ cmdline.append(hglib.fromutf(self.destentry.get_text()))
+
+ dlg = hgcmd.CmdDialog(cmdline)
+ dlg.run()
+ dlg.hide()
+
+def run(ui, *pats, **opts):
+ return ArchiveDialog(opts.get('rev'))
|
@@ -11,9 +11,11 @@ import pango
from mercurial import hg, ui
+
from thgutil.i18n import _
from thgutil import hglib, paths
-from hggtk import gtklib, hgcmd
+
+from hggtk import changesetinfo, gtklib, hgcmd
class BackoutDialog(gtk.Window):
""" Backout effect of a changeset """
@@ -36,11 +38,8 @@ self.add(vbox)
frame = gtk.Frame(_('Changeset Description'))
- lbl = gtk.Label()
- desc = self.revdesc(repo, rev)
- lbl.set_markup(desc)
- lbl.set_alignment(0, 0)
- frame.add(lbl)
+ rev, desc = changesetinfo.changesetinfo(repo, rev)
+ frame.add(desc)
frame.set_border_width(5)
vbox.pack_start(frame, False, False, 2)
@@ -87,23 +86,6 @@
backout.connect('clicked', self.backout, buf, rev)
- def revdesc(self, repo, revid):
- ctx = repo[revid]
- revstr = str(ctx.rev())
- summary = ctx.description().replace('\0', '')
- summary = summary.split('\n')[0]
- escape = gtklib.markup_escape_text
- desc = '<b>' + hglib.fromutf(_('rev')) + '</b>\t\t: %s\n' % escape(revstr)
- desc += '<b>' + hglib.fromutf(_('summary')) + '</b>\t: %s\n' % escape(summary[:80])
- desc += '<b>' + hglib.fromutf(_('user')) + '</b>\t\t: %s\n' % escape(ctx.user())
- desc += '<b>' + hglib.fromutf(_('date')) + '</b>\t\t: %s\n' % escape(hglib.displaytime(ctx.date()))
- node = repo.lookup(revid)
- tags = repo.nodetags(node)
- desc += '<b>' + hglib.fromutf(_('branch')) + '</b>\t: ' + escape(ctx.branch())
- if tags:
- desc += '\n<b>' + hglib.fromutf(_('tags')) + '</b>\t\t: ' + escape(', '.join(tags))
- return hglib.toutf(desc)
-
def set_notify_func(self, func, *args):
self.notify_func = func
self.notify_args = args
|
|
@@ -146,25 +146,40 @@
eob = buf.get_end_iter()
date = displaytime(ctx.date())
- change = str(rev) + ' : ' + str(ctx)
+ change = str(rev) + ' (' + str(ctx) + ')'
tags = ' '.join(ctx.tags())
title_line(_('changeset:'), change, 'changeset')
if ctx.branch() != 'default':
title_line(_('branch:'), ctx.branch(), 'greybg')
title_line(_('user/date:'), ctx.user() + '\t' + date, 'changeset')
+
+ if len(ctx.parents()) == 2 and self.parent_toggle.get_active():
+ parentindex = 1
+ else:
+ parentindex = 0
+
for pctx in ctx.parents():
try:
summary = pctx.description().splitlines()[0]
summary = toutf(summary)
except:
summary = ""
- change = str(pctx.rev()) + ' : ' + str(pctx)
+ change = str(pctx.rev()) + ' (' + str(pctx) + ')'
+ if pctx.branch() != ctx.branch():
+ change += ' [' + toutf(pctx.branch()) + ']'
title = _('parent:')
title += ' ' * (12 - len(title))
- buf.insert_with_tags_by_name(eob, title, 'parent')
- buf.insert_with_tags_by_name(eob, change, 'link')
- buf.insert_with_tags_by_name(eob, ' ' + summary, 'parent')
+
+ if len(ctx.parents()) == 2 and pctx == ctx.parents()[parentindex]:
+ buf.insert_with_tags_by_name(eob, title, 'parenthl')
+ buf.insert_with_tags_by_name(eob, change, 'linkhl')
+ buf.insert_with_tags_by_name(eob, ' ' + summary, 'parenthl')
+ else:
+ buf.insert_with_tags_by_name(eob, title, 'parent')
+ buf.insert_with_tags_by_name(eob, change, 'link')
+ buf.insert_with_tags_by_name(eob, ' ' + summary, 'parent')
+
buf.insert(eob, "\n")
for cctx in ctx.children():
try:
@@ -172,7 +187,9 @@ summary = toutf(summary)
except:
summary = ""
- change = str(cctx.rev()) + ' : ' + str(cctx)
+ change = str(cctx.rev()) + ' (' + str(cctx) + ')'
+ if cctx.branch() != ctx.branch():
+ change += ' [' + toutf(cctx.branch()) + ']'
title = _('child:')
title += ' ' * (12 - len(title))
buf.insert_with_tags_by_name(eob, title, 'parent')
@@ -267,10 +284,9 @@ text = self.get_link_text(tag, widget, liter)
if not text:
return
- linkrev = long(text.split(':')[0])
+ linkrev = long(text.split(' ')[0])
if self.graphview:
- self.graphview.set_revision_id(linkrev)
- self.graphview.scroll_to_revision(linkrev)
+ self.graphview.set_revision_id(linkrev, load=True)
else:
self.load_details(linkrev)
@@ -423,6 +439,9 @@ paragraph_background='#F0F0F0'))
tag_table.add(make_texttag('parent', foreground='#000090',
paragraph_background='#F0F0F0'))
+ tag_table.add(make_texttag('parenthl', foreground='#000090',
+ paragraph_background='#F0F0F0',
+ weight=pango.WEIGHT_BOLD ))
tag_table.add( make_texttag( 'mono', family='Monospace' ))
tag_table.add( make_texttag( 'blue', foreground='blue' ))
@@ -435,8 +454,13 @@ tag_table.add( make_texttag( 'yellowbg', background='yellow' ))
link_tag = make_texttag( 'link', foreground='blue',
underline=pango.UNDERLINE_SINGLE )
+ linkhl_tag = make_texttag( 'linkhl', foreground='blue',
+ underline=pango.UNDERLINE_SINGLE,
+ weight=pango.WEIGHT_BOLD )
link_tag.connect('event', self.link_event )
+ linkhl_tag.connect('event', self.link_event )
tag_table.add( link_tag )
+ tag_table.add( linkhl_tag )
def file_button_release(self, widget, event):
if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |
@@ -523,7 +547,7 @@ parent = parents[0]
pair = '%u:%u' % (parent, rev)
self._node1, self._node2 = cmdutil.revpair(self.repo, [pair])
- self._view_file('M', self.curfile, force_left=False)
+ self._view_files([self.curfile], False)
def ann_file(self, menuitem):
'User selected annotate file from the file list context menu'
@@ -540,6 +564,7 @@ # send this event to the main app
opts = {'pats' : [self.curfile]}
self.glog_parent.custombutton.set_active(True)
+ self.glog_parent.filter = 'custom'
self.glog_parent.reload_log(**opts)
else:
# Else launch our own glog instance
|
|
@@ -0,0 +1,63 @@ + # changesetinfo.py - component for displaying changeset summary
+#
+# Copyright 2009 Yuki KODAMA <endflow.net@gmail.com>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2, incorporated herein by reference.
+
+'''component for displaying changeset summary'''
+
+import os
+import gtk
+
+from thgutil.i18n import _
+from thgutil import hglib
+
+from hggtk import gtklib
+
+def changesetinfo(repo, revid, head=False):
+ def lbl(str, bold=False, right=False):
+ str = gtklib.markup_escape_text(str)
+ label = gtk.Label()
+ if bold:
+ str = '<b>%s</b>' % str
+ label.set_alignment((1 if right else 0), 0)
+ label.set_markup(str)
+ return label
+ def addrow(table, header=None, value=None):
+ row = table.get_property('n-rows')
+ table.set_property('n-rows', row + 1)
+ if header:
+ if isinstance(header, str):
+ header = lbl(header, True, True)
+ table.attach(header, 0, 1, row, row + 1, gtk.FILL, 0, 4, 1)
+ if value:
+ if isinstance(value, str):
+ value = lbl(value)
+ table.attach(value, 1, 2, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 4, 1)
+
+ # prepare data to display
+ table = gtk.Table(1, 2)
+ ctx = repo[revid]
+ revstr = str(ctx.rev())
+ summary = ctx.description().replace('\0', '').split('\n')[0]
+ node = repo.lookup(revid)
+ tags = repo.nodetags(node)
+
+ # construct gtk.Table
+ addrow(table, _('rev'), revstr)
+ addrow(table, _('summary'), hglib.toutf(summary[:80]))
+ addrow(table, _('user'), hglib.toutf(ctx.user()))
+ addrow(table, _('date'), hglib.displaytime(ctx.date()))
+ addrow(table, _('branch'), hglib.toutf(ctx.branch()))
+ if tags:
+ addrow(table, _('tags'), hglib.toutf(', '.join(tags)))
+ if head and node not in repo.heads():
+ addrow(table, value=lbl(_('Not a head revision!'), True))
+
+ # just for padding
+ vbox = gtk.VBox()
+ vbox.pack_start(table, True, True, 3)
+ hbox = gtk.HBox()
+ hbox.pack_start(vbox, True, True, 4)
+ return revstr, hbox
|
|
|
@@ -16,17 +16,26 @@ from thgutil import hglib, shlib, settings
from hggtk import gdialog, gtklib, hgcmd
-class CloneDialog(gtk.Window):
+class CloneDialog(gtk.Dialog):
""" Dialog to clone a Mercurial repo """
def __init__(self, repos=[]):
""" Initialize the Dialog """
- gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+ gtk.Dialog.__init__(self, title=_('TortoiseHg Clone'),
+ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
gtklib.set_tortoise_icon(self, 'menuclone.ico')
gtklib.set_tortoise_keys(self)
- self.set_default_size(520, 180)
- self.set_title(_('TortoiseHg Clone'))
+ self.set_resizable(False)
+ self.set_has_separator(False)
+ self.connect('response', self.dialog_response)
+
+ # add clone button
+ clonebutton = gtk.Button(_('Clone'))
+ clonebutton.connect('clicked', lambda b: self.clone())
+ self.action_area.pack_end(clonebutton)
self.ui = ui.ui()
+
+ # persistent settings
self.clonesettings = settings.Settings('clone')
self.recentsrc = self.clonesettings.mrul('src_paths')
self.recentdest = self.clonesettings.mrul('dest_paths')
@@ -39,39 +48,67 @@ elif len(repos):
srcpath = repos[0]
- ewidth = 20
+ # copy from 'thgconfig.py'
+ def createtable(cols=2):
+ newtable = gtk.Table(1, cols)
+ def addrow(*widgets):
+ row = newtable.get_property('n-rows')
+ newtable.set_property('n-rows', row + 1)
+ def getwidget(obj):
+ if obj == None:
+ return gtk.Label('')
+ elif isinstance(obj, (int, long)):
+ widget = gtk.Label('')
+ widget.set_width_chars(obj)
+ return widget
+ return obj
+ if len(widgets) == 1:
+ col = newtable.get_property('n-columns')
+ widget = getwidget(widgets[0])
+ newtable.attach(widget, 0, col, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 4, 2)
+ else:
+ for col, widget in enumerate(widgets):
+ widget = getwidget(widget)
+ flag = gtk.FILL if col == 0 else gtk.FILL|gtk.EXPAND
+ newtable.attach(widget, col, col + 1, row, row + 1, flag, 0, 4, 2)
+ return newtable, addrow
- vbox = gtk.VBox()
- self.add(vbox)
+ # layout table for fixed options
+ table, addrow = createtable()
+ self.vbox.pack_start(table, True, True, 2)
+ def setcombosize(combo):
+ combo.set_size_request(300, -1)
+ combo.size_request()
- # clone source
+ ## clone source label
+ lbl = gtk.Label(_('Source path:'))
+ lbl.set_alignment(1, 0.5)
+
+ ## comboentry for source paths
srcbox = gtk.HBox()
- lbl = gtk.Label(_('Source Path:'))
- lbl.set_property('width-chars', ewidth)
- lbl.set_alignment(0, 0.5)
-
- # create drop-down list for source paths
self.srclist = gtk.ListStore(str)
srccombo = gtk.ComboBoxEntry(self.srclist, 0)
+ setcombosize(srccombo)
self.srcentry = srccombo.get_child()
self.srcentry.set_text(srcpath)
self.srcentry.set_position(-1)
+ srcbox.pack_start(srccombo)
- # replace the drop-down widget so we can modify it's properties
+ ## replace the drop-down widget so we can modify it's properties
srccombo.clear()
cell = gtk.CellRendererText()
cell.set_property('ellipsize', pango.ELLIPSIZE_MIDDLE)
srccombo.pack_start(cell)
srccombo.add_attribute(cell, 'text', 0)
+ ## source browse button
srcbrowse = gtk.Button(_('Browse...'))
srcbrowse.connect('clicked', self.source_browse_clicked)
- srcbox.pack_start(lbl, False, False)
- srcbox.pack_start(srccombo, True, True)
- srcbox.pack_end(srcbrowse, False, False, 5)
- vbox.pack_start(srcbox, False, False, 2)
+ srcbox.pack_start(srcbrowse, False, False, 4)
- # add pre-defined src paths to pull-down list
+ addrow(lbl, srcbox)
+
+ ## add pre-defined src paths to pull-down list
sync_src = settings.Settings('synch').mrul('src_paths')
sympaths = [x[1] for x in self.ui.configitems('paths')]
recent = [x for x in self.recentsrc]
@@ -81,97 +118,98 @@ for p in paths:
self.srclist.append([p])
- # clone destination
+ ## clone dest label
+ lbl = gtk.Label(_('Destination path:'))
+ lbl.set_alignment(1, 0.5)
+
+ ## comboentry for destination paths
destbox = gtk.HBox()
- lbl = gtk.Label(_('Destination Path:'))
- lbl.set_property('width-chars', ewidth)
- lbl.set_alignment(0, 0.5)
self.destlist = gtk.ListStore(str)
destcombo = gtk.ComboBoxEntry(self.destlist, 0)
+ setcombosize(destcombo)
self.destentry = destcombo.get_child()
self.destentry.set_text(destpath)
self.destentry.set_position(-1)
- self.destentry.connect('activate', self.clone_clicked)
+ self.destentry.connect('activate', lambda b: self.clone())
+ destbox.pack_start(destcombo)
- # replace the drop-down widget so we can modify it's properties
+ ## replace the drop-down widget so we can modify it's properties
destcombo.clear()
cell = gtk.CellRendererText()
cell.set_property('ellipsize', pango.ELLIPSIZE_MIDDLE)
destcombo.pack_start(cell)
destcombo.add_attribute(cell, 'text', 0)
- srcbrowse = gtk.Button(_('Browse...'))
- srcbrowse.connect('clicked', self.dest_browse_clicked)
- destbox.pack_start(lbl, False, False)
- destbox.pack_start(destcombo, True, True)
- destbox.pack_end(srcbrowse, False, False, 5)
- vbox.pack_start(destbox, False, False, 2)
+ ## source browse button
+ destbrowse = gtk.Button(_('Browse...'))
+ destbrowse.connect('clicked', self.dest_browse_clicked)
+ destbox.pack_end(destbrowse, False, False, 4)
- # add most-recent dest paths to pull-down list
+ addrow(lbl, destbox)
+
+ ## add most-recent dest paths to pull-down list
paths = list(self.recentdest)
paths.sort()
for p in paths:
self.destlist.append([p])
- # revision input
- revbox = gtk.HBox()
- lbl = gtk.Label(_('Clone To Revision:'))
- lbl.set_property('width-chars', ewidth)
- lbl.set_alignment(0, 0.5)
+ # expander for advanced options
+ self.expander = expander = gtk.Expander(_('Advanced options'))
+ self.vbox.pack_start(expander, True, True, 2)
+
+ # layout table for advanced options
+ table, addrow = createtable()
+ expander.add(table)
+
+ ## revision option
+ hbox = gtk.HBox()
self.reventry = gtk.Entry()
- self.reventry.set_text("")
- revbox.pack_start(lbl, False, False)
- revbox.pack_start(self.reventry, False, False)
- vbox.pack_start(revbox, False, False, 2)
+ self.reventry.set_sensitive(False)
+ self.optrev = gtk.CheckButton(_('Clone to revision:'))
+ self.optrev.connect('toggled', self.checkbutton_toggled, self.reventry)
+ hbox.pack_start(self.optrev, False, False)
+ hbox.pack_start(self.reventry, False, False, 4)
+ addrow(hbox)
- # options
- option_box = gtk.VBox()
- self.optupdate = gtk.CheckButton(_('do not update the new working directory'))
- self.optpull = gtk.CheckButton(_('use pull protocol to copy metadata'))
- self.optuncomp = gtk.CheckButton(_('use uncompressed transfer'))
- self.optproxy = gtk.CheckButton(_('use proxy server'))
- option_box.pack_start(self.optupdate, False, False)
- option_box.pack_start(self.optpull, False, False)
- option_box.pack_start(self.optuncomp, False, False)
- option_box.pack_start(self.optproxy, False, False)
- vbox.pack_start(option_box, False, False, 15)
+ ## options
+ self.optupdate = gtk.CheckButton(_('Do not update the new working directory'))
+ self.optpull = gtk.CheckButton(_('Use pull protocol to copy metadata'))
+ self.optuncomp = gtk.CheckButton(_('Use uncompressed transfer'))
+ addrow(self.optupdate)
+ addrow(self.optpull)
+ addrow(self.optuncomp)
+ ## proxy options
+ self.optproxy = gtk.CheckButton(_('Use proxy server'))
+ addrow(self.optproxy)
if self.ui.config('http_proxy', 'host'):
self.optproxy.set_active(True)
else:
self.optproxy.set_sensitive(False)
- # remote cmd
- lbl = gtk.Label(_('Remote Cmd:'))
- lbl.set_alignment(0, 0.5)
+ ## remote cmd option
self.remotecmdentry = gtk.Entry()
- vbox.pack_start(self.remotecmdentry, False, False, 1)
- vbox.pack_start(lbl, False, False, 1)
+ self.remotecmdentry.set_sensitive(False)
+ self.optremote = gtk.CheckButton(_('Remote command:'))
+ self.optremote.connect('toggled', self.checkbutton_toggled, self.remotecmdentry)
+ addrow(self.optremote)
+ addrow(self.remotecmdentry)
- accelgroup = gtk.AccelGroup()
- self.add_accel_group(accelgroup)
- mod = gtklib.get_thg_modifier()
+ # prepare to show
+ self.load_settings()
+ destcombo.grab_focus()
- hbbox = gtk.HButtonBox()
- hbbox.set_layout(gtk.BUTTONBOX_END)
- vbox.pack_start(hbbox, False, False, 2)
+ def load_settings(self):
+ expanded = self.clonesettings.get_value('expanded', False, True)
+ self.expander.set_property('expanded', expanded)
- close = gtk.Button(_('Cancel'))
- close.connect('clicked', lambda x: self.destroy())
- key, modifier = gtk.accelerator_parse('Escape')
- close.add_accelerator('clicked', accelgroup, key, 0,
- gtk.ACCEL_VISIBLE)
- self.close_button = close
- hbbox.add(close)
+ def store_settings(self):
+ expanded = self.expander.get_property('expanded')
+ self.clonesettings.set_value('expanded', expanded)
+ self.clonesettings.write()
- clone = gtk.Button(_('Clone'))
- key, modifier = gtk.accelerator_parse(mod+'Return')
- clone.add_accelerator('clicked', accelgroup, key, modifier,
- gtk.ACCEL_VISIBLE)
- clone.connect('clicked', self.clone_clicked)
- hbbox.add(clone)
-
- destcombo.grab_focus()
+ def dialog_response(self, dialog, response_id):
+ self.store_settings()
def dest_browse_clicked(self, button):
'select folder as clone destination'
@@ -189,6 +227,12 @@ if response:
self.srcentry.set_text(response)
+ def checkbutton_toggled(self, checkbutton, entry):
+ state = checkbutton.get_active()
+ entry.set_sensitive(state)
+ if state:
+ entry.grab_focus()
+
def add_src_to_recent(self, src):
if os.path.exists(src):
src = os.path.abspath(src)
@@ -222,7 +266,7 @@ for p in paths:
self.destlist.append([p])
- def clone_clicked(self, toolbutton, data=None):
+ def clone(self):
# gather input data
src = self.srcentry.get_text()
dest = self.destentry.get_text() or os.path.basename(src)
@@ -292,7 +336,8 @@
self.add_src_to_recent(src)
self.add_dest_to_recent(dest)
- self.close_button.grab_focus()
+ cancel = [b for b in self.action_area if b.get_label() == 'gtk-cancel'][0]
+ cancel.grab_focus()
if dlg.return_code() == 0:
shlib.shell_notify([dest])
|
|
|
@@ -26,16 +26,28 @@ from hggtk import gtklib, thgconfig, gdialog, hgcmd
class BranchOperationDialog(gtk.Dialog):
- def __init__(self, branch, close):
+ def __init__(self, branch, close, mergebranches):
gtk.Dialog.__init__(self, parent=None, flags=gtk.DIALOG_MODAL,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
gtk.STOCK_OK, gtk.RESPONSE_OK))
gtklib.set_tortoise_keys(self)
- self.connect('response', self.response)
self.set_title(_('Branch Operations'))
self.newbranch = None
self.closebranch = False
+ if mergebranches:
+ lbl = gtk.Label(_('Select branch of merge commit'))
+ branchcombo = gtk.combo_box_new_text()
+ for name in mergebranches:
+ branchcombo.append_text(name)
+ branchcombo.set_active(0)
+ self.vbox.pack_start(lbl, True, True, 2)
+ self.vbox.pack_start(branchcombo, True, True, 2)
+ self.connect('response', self.merge_response, branchcombo)
+ self.show_all()
+ return
+
+ self.connect('response', self.response)
lbl = gtk.Label(_('Changes take effect on next commit'))
nochanges = gtk.RadioButton(None, _('No branch changes'))
self.newbranchradio = gtk.RadioButton(nochanges,
@@ -89,6 +101,14 @@ self.closebranch = False
self.destroy()
+ def merge_response(self, widget, response_id, combo):
+ self.closebranch = False
+ if response_id == gtk.RESPONSE_OK:
+ row = combo.get_active()
+ if row == 1:
+ self.newbranch = combo.get_model()[row][0]
+ self.destroy()
+
class GCommit(GStatus):
"""GTK+ based dialog for displaying repository status and committing
@@ -161,13 +181,19 @@
def get_tbbuttons(self):
tbbuttons = GStatus.get_tbbuttons(self)
- tbbuttons.insert(2, gtk.SeparatorToolItem())
+ tbbuttons.insert(0, gtk.SeparatorToolItem())
self.undo_button = self.make_toolbutton(gtk.STOCK_UNDO, _('_Undo'),
self.undo_clicked, tip=_('undo recent commit'))
self.commit_button = self.make_toolbutton(gtk.STOCK_OK, _('_Commit'),
self.commit_clicked, tip=_('commit'))
- tbbuttons.insert(2, self.undo_button)
- tbbuttons.insert(2, self.commit_button)
+ tbbuttons.insert(0, self.undo_button)
+ tbbuttons.insert(0, self.commit_button)
+
+ self.changelog_button = self.make_toolbutton(gtk.STOCK_INDEX, _('Changelog'),
+ self.changelog_clicked, tip=_('view changelog'))
+ tbbuttons.append(self.changelog_button)
+ tbbuttons.append(gtk.SeparatorToolItem())
+
return tbbuttons
@@ -202,7 +228,11 @@ liststore.append([sumline, msg])
def branch_clicked(self, button):
- dialog = BranchOperationDialog(self.nextbranch, self.closebranch)
+ if self.merging:
+ mb = [p.branch() for p in self.repo.parents()]
+ else:
+ mb = None
+ dialog = BranchOperationDialog(self.nextbranch, self.closebranch, mb)
dialog.run()
self.nextbranch = None
self.closebranch = False
@@ -222,6 +252,10 @@ self.branchbutton = gtk.Button()
self.branchbutton.connect('clicked', self.branch_clicked)
mbox.pack_start(self.branchbutton, False, False, 2)
+ if self.merging:
+ branches = [p.branch() for p in self.repo.parents()]
+ if branches[0] == branches[1]:
+ self.branchbutton.set_sensitive(False)
if hasattr(self.repo, 'mq'):
label = gtk.Label('QNew: ')
@@ -238,7 +272,7 @@ cell = gtk.CellRendererText()
self.msg_cbbox.pack_start(cell, True)
self.msg_cbbox.add_attribute(cell, 'text', 0)
- liststore.append([_('Recent Commit Messages...'), ''])
+ liststore.append([_('Recent commit messages...'), ''])
self.msg_cbbox.set_active(0)
self.popupid = self.msg_cbbox.connect('notify::popup-shown',
self.first_msg_popdown)
@@ -258,35 +292,63 @@ self.text.connect('populate-popup', self.msg_add_to_popup)
self.text.modify_font(pango.FontDescription(self.fontcomment))
scroller.add(self.text)
+ gtklib.addspellcheck(self.text, self.repo.ui)
+
+ self.parents_frame = gtk.Frame(_('Parent'))
+ parents_vbox = gtk.VBox(spacing=2)
+ self.parents_frame.add(parents_vbox)
+ def plabel():
+ w = gtk.Label()
+ w.set_selectable(True)
+ hb = gtk.HBox()
+ hb.pack_start(w, False, False, 4)
+ parents_vbox.pack_start(hb, False, False)
+ return w
+ self.parent1_label = plabel()
+ self.parent2_label = plabel()
+ vbox.pack_start(self.parents_frame, False, False)
self.vpaned = gtk.VPaned()
- self.vpaned.add1(vbox)
- self.vpaned.add2(status_body)
+ self.vpaned.pack1(vbox, shrink=False)
+ self.vpaned.pack2(status_body, shrink=False)
gobject.idle_add(self.realize_settings)
return self.vpaned
+ def update_parent_labels(self):
+ def setlabel(label, ctx):
+ s = str(ctx.rev()) + ' (' + str(ctx) + ') '
+ s += hglib.toutf(ctx.description().split('\n')[0])
+ label.set_markup('<span face="monospace">%s</span>' % s)
+
+ if self.mqmode:
+ ctxs = self.repo['.'].parents()
+ else:
+ ctxs = self.repo[None].parents()
+ setlabel(self.parent1_label, ctxs[0])
+ if len(ctxs) == 2:
+ setlabel(self.parent2_label, ctxs[1])
+ self.parent2_label.show()
+ self.parents_frame.set_label(_('Parents'))
+ else:
+ self.parent2_label.hide()
+
def realize_settings(self):
self.vpaned.set_position(self._setting_vpos)
def thgaccept(self, window):
self.commit_clicked(None)
- def get_menu_info(self):
- """Returns menu info in this order: merge, addrem, unknown,
- clean, ignored, deleted
- """
- merge, addrem, unknown, clean, ignored, deleted, unresolved, resolved \
- = GStatus.get_menu_info(self)
- return (merge + ((_('_commit'), self.commit_file),),
- addrem + ((_('_commit'), self.commit_file),),
- unknown + ((_('_commit'), self.commit_file),),
- clean,
- ignored,
- deleted + ((_('_commit'), self.commit_file),),
- unresolved,
- resolved,
- )
-
+ def get_custom_menus(self):
+ def commit(menuitem, files):
+ if self.ready_message() and self.isuptodate():
+ self.hg_commit(files)
+ self.reload_status()
+ abs = [self.repo.wjoin(file) for file in files]
+ shlib.shell_notify(abs)
+ if self.merging:
+ return ()
+ else:
+ return [(_('_commit'), commit, 'MAR'),]
def delete(self, window, event):
if not self.should_live():
@@ -300,14 +362,15 @@ live = False
buf = self.text.get_buffer()
if buf.get_char_count() > 10 and buf.get_modified():
- dialog = gdialog.Confirm(_('Confirm Exit'), [], self,
- _('Save commit message at exit?'))
- res = dialog.run()
- if res == gtk.RESPONSE_YES:
+ # response: 0=Yes, 1=No, 2=Cancel
+ response = gdialog.CustomPrompt(_('Confirm Exit'),
+ _('Save commit message at exit?'), self,
+ (_('&Yes'), _('&No'), _('&Cancel')), 2, 2).run()
+ if response == 0:
begin, end = buf.get_bounds()
self.update_recent_messages(buf.get_text(begin, end))
buf.set_modified(False)
- elif res != gtk.RESPONSE_NO:
+ elif response == 2:
live = True
if not live:
self._destroying(widget)
@@ -321,6 +384,7 @@ self.check_patch_queue()
self.check_undo()
self.refresh_branchop()
+ self.update_parent_labels()
return success
@@ -342,11 +406,6 @@
def check_merge(self):
- self.get_toolbutton(_('Re_vert')).set_sensitive(not self.merging)
- self.get_toolbutton(_('_Add')).set_sensitive(not self.merging)
- self.get_toolbutton(_('_Remove')).set_sensitive(not self.merging)
- self.get_toolbutton(_('Move')).set_sensitive(not self.merging)
-
if self.merging:
# select all changes if repo is merged
for entry in self.filemodel:
@@ -396,20 +455,20 @@ self.branchbutton.set_sensitive(not (self.mqmode or self.qnew))
def commit_clicked(self, toolbutton, data=None):
- if not self.ready_message():
+ if not (self.ready_message() or self.isuptodate()):
return
commitable = 'MAR'
if self.merging:
- commit_list = self.relevant_files(commitable)
+ commit_list = self.relevant_checked_files(commitable)
# merges must be committed without specifying file list.
self.hg_commit([])
else:
- addremove_list = self.relevant_files('?!')
+ addremove_list = self.relevant_checked_files('?!')
if len(addremove_list) and self.should_addremove(addremove_list):
commitable += '?!'
- commit_list = self.relevant_files(commitable)
+ commit_list = self.relevant_checked_files(commitable)
if len(commit_list) > 0:
self.commit_selected(commit_list)
elif len(self.filemodel) == 0 and self.qnew:
@@ -477,13 +536,8 @@ if dopatch:
try:
pfiles = {}
- if patch.patchfile.__bases__:
- # Mercurial 1.3
- patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
+ patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
eolmode=None)
- else:
- # Mercurial 1.2
- patch.internalpatch(fp, ui, 1, repo.root, files=pfiles)
patch.updatedir(ui, repo, pfiles)
except patch.PatchError, err:
s = str(err)
@@ -519,24 +573,15 @@ pass
- def commit_file(self, stat, file):
- if self.ready_message():
- if stat not in '?!' or self.should_addremove([file]):
- self.hg_commit([file])
- self.reload_status()
- shlib.shell_notify([self.repo.wjoin(file)])
- return True
-
-
def undo_clicked(self, toolbutton, data=None):
- response = gdialog.Confirm(_('Confirm Undo commit'),
+ response = gdialog.Confirm(_('Confirm Undo Commit'),
[], self, _('Undo last commit')).run()
if response != gtk.RESPONSE_YES:
return
tip = self.get_tip_rev(True)
if not tip == self.last_commit_id:
- gdialog.Prompt(_('Undo commit'),
+ gdialog.Prompt(_('Undo Commit'),
_('Unable to undo!\n\n'
'Tip revision differs from last commit.'),
self).run()
@@ -551,10 +596,17 @@ time.sleep(0.5) # give fs some time to pick up changes
shlib.shell_notify([os.getcwd()])
except:
- gdialog.Prompt(_('Undo commit'),
+ gdialog.Prompt(_('Undo Commit'),
_('Errors during rollback!'), self).run()
+ def changelog_clicked(self, toolbutton, data=None):
+ from hggtk import history
+ dlg = history.run(self.ui)
+ dlg.display()
+ return True
+
+
def should_addremove(self, files):
if self.test_opt('addremove'):
return True
@@ -651,20 +703,23 @@ cmdline = ['hg', 'commit', '--verbose', '--repository', self.repo.root]
if self.nextbranch:
+ # response: 0=Yes, 1=No, 2=Cancel
newbranch = hglib.fromutf(self.nextbranch)
if newbranch in self.repo.branchtags():
- if newbranch not in [p.branch() for p in self.repo.parents()]:
- response = gdialog.Confirm(_('Confirm Override Branch'),
- [], self, _('A branch named "%s" already exists,\n'
- 'override?') % self.nextbranch).run()
+ if newbranch in [p.branch() for p in self.repo.parents()]:
+ response = 0
else:
- response = gtk.RESPONSE_YES
+ response = gdialog.CustomPrompt(_('Confirm Override Branch'),
+ _('A branch named "%s" already exists,\n'
+ 'override?') % self.nextbranch, self,
+ (_('&Yes'), _('&No'), _('&Cancel')), 2, 2).run()
else:
- response = gdialog.Confirm(_('Confirm New Branch'), [], self,
- _('Create new named branch "%s"?') % self.nextbranch).run()
- if response == gtk.RESPONSE_YES:
+ response = gdialog.CustomPrompt(_('Confirm New Branch'),
+ _('Create new named branch "%s"?') % self.nextbranch,
+ self, (_('&Yes'), _('&No'), _('&Cancel')), 2, 2).run()
+ if response == 0:
self.repo.dirstate.setbranch(newbranch)
- elif response != gtk.RESPONSE_NO:
+ elif response == 2:
return
elif self.closebranch:
cmdline.append('--close-branch')
@@ -760,7 +815,7 @@ sumlen = 0
maxlen = 0
if not (sumlen or maxlen):
- gdialog.Prompt(_('Info required'),
+ gdialog.Prompt(_('Info Required'),
_('Message format needs to be configured'),
self).run()
self.msg_config(None)
|
@@ -222,7 +222,7 @@ search_hbox.pack_start(includes, True, True, 4)
search_hbox.pack_start(gtk.Label(_('Excludes:')), False, False, 4)
search_hbox.pack_start(excludes, True, True, 4)
- search_hbox.pack_start(search, False, False)
+ search_hbox.pack_start(search, False, False, 4)
self.tooltips.set_tip(search, _('Start this search'))
self.tooltips.set_tip(regexp, _('Regular expression search pattern'))
self.tooltips.set_tip(includes, _('Comma separated list of'
@@ -448,8 +448,11 @@ def close_page(self, button, widget):
'''Close page button has been pressed'''
num = self.notebook.page_num(widget)
- if num != -1 and self.notebook.get_n_pages() > 1:
+ if num != -1:
self.notebook.remove_page(num)
+ if self.notebook.get_n_pages() <= 1:
+ self.newpagecount = 1
+ self.add_search_page()
def add_header_context_menu(self, col, menu):
lb = gtk.Label(col.get_title())
|
@@ -46,27 +46,30 @@ class CustomPrompt(gtk.MessageDialog):
''' Custom prompt dialog. Provide a list of choices with ampersands
to delineate response given for each choice (and keyboard
- accelerator). Default must be one of the choice responses.
+ accelerator). Default must be the index of one of the choice responses.
'''
- # ret = CustomPrompt('Title', 'Message', self, ('&Yes', 'N&o'), 'o').run()
- # ret will be (gtk.RESPONSE_DELETE_EVENT, ord('y'), or ord('o'))
- def __init__(self, title, message, parent, choices, default=None):
+ # ret = CustomPrompt('Title', 'Message', self, ('&Yes', 'N&o'), 1).run()
+ # ret will be (gtk.RESPONSE_DELETE_EVENT, 0 (for yes), or 1 (for no)
+ def __init__(self, title, message, parent, choices, default=None, esc=None):
gtk.MessageDialog.__init__(self, parent, gtk.DIALOG_MODAL,
gtk.MESSAGE_QUESTION)
self.set_title(hglib.toutf(title))
self.format_secondary_markup('<b>' + hglib.toutf(message) + '</b>')
accel_group = gtk.AccelGroup()
self.add_accel_group(accel_group)
- for s in choices:
+ for i, s in enumerate(choices):
char = s[s.index('&')+1].lower()
- button = self.add_button(s.replace('&', '_'), ord(char))
+ button = self.add_button(s.replace('&', '_'), i)
button.add_accelerator('clicked', accel_group, ord(char), 0,
gtk.ACCEL_VISIBLE)
if default:
- self.set_default_response(ord(default))
+ self.set_default_response(default)
+ self.esc = esc
def run(self):
response = gtklib.MessageDialog.run(self)
+ if response == gtk.RESPONSE_DELETE_EVENT and self.esc != None:
+ response = self.esc
self.destroy()
return response
@@ -415,7 +418,7 @@ def _diff_file(self, stat, file):
self._do_diff(file and [file] or [], self.opts)
- def _view_file(self, stat, file, force_left=False):
+ def _view_files(self, files, otherparent):
from hggtk import thgconfig
def cleanup():
shutil.rmtree(self.tmproot)
@@ -460,18 +463,20 @@ pathroot = self.repo.root
copynode = None
# if we aren't looking at the wc, copy the node...
- if stat in 'R!' or force_left:
+ if otherparent:
copynode = self._node1
elif self._node2:
copynode = self._node2
if copynode:
- copydir = snapshot_node(self.ui, self.repo,
- [util.pconvert(file)], copynode, self.tmproot)
+ pf = [util.pconvert(f) for f in files]
+ copydir = snapshot_node(self.ui, self.repo, pf,
+ copynode, self.tmproot)
pathroot = os.path.join(self.tmproot, copydir)
- file_path = os.path.join(pathroot, file)
- util.system("%s \"%s\"" % (editor, file_path),
+ paths = ['"'+os.path.join(pathroot, f)+'"' for f in files]
+ command = editor + ' ' + ' '.join(paths)
+ util.system(command,
environ={'HGUSER': self.ui.username()},
onerr=self.ui, errprefix=_('edit failed'))
@@ -492,8 +497,8 @@ self._parse_config()
return
- file = util.localpath(file)
- thread = threading.Thread(target=doedit, name='edit:'+file)
+ lfile = util.localpath(files[0])
+ thread = threading.Thread(target=doedit, name='edit:'+lfile)
thread.setDaemon(True)
thread.start()
|
|
@@ -0,0 +1,57 @@ + # gorev.py - TortoiseHg's dialog for selecting a revision
+#
+# Copyright 2007 TK Soh <teekaysoh@gmail.com>
+# Copyright 2007 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.
+
+import os
+import gtk
+import gobject
+import mercurial
+
+from thgutil.i18n import _
+from hggtk import gtklib, gdialog
+
+
+class GotoRevDialog(gtk.Dialog):
+ 'Dialog for selecting a revision'
+ def __init__(self, gotofunc):
+ super(GotoRevDialog, self).__init__(flags=gtk.DIALOG_MODAL)
+ gtklib.set_tortoise_icon(self, 'menulog.ico')
+ gtklib.set_tortoise_keys(self)
+
+ self._btn_goto = gtk.Button(_('Select'))
+ self._btn_goto.connect('clicked', self._btn_goto_clicked)
+ self.action_area.pack_end(self._btn_goto)
+
+ self.set_title(_('Select Revision'))
+
+ self.gotofunc = gotofunc
+
+ self.tips = gtk.Tooltips()
+
+ hbox = gtk.HBox()
+ self.revEntry = gtk.Entry()
+ self.revEntry.connect('activate', self._btn_goto_clicked)
+ hbox.pack_start(self.revEntry, True, True, 4)
+ eventbox = gtk.EventBox()
+ eventbox.add(hbox)
+ self.tips.set_tip(
+ eventbox, _('revision number, changeset ID, branch or tag'))
+ self.vbox.pack_start(eventbox, False, False, 4)
+
+ self.revEntry.grab_focus()
+
+ self.show_all()
+
+ def _btn_goto_clicked(self, button, data=None):
+ try:
+ revision = self.revEntry.get_text()
+ if self.gotofunc:
+ self.gotofunc(revision)
+ except mercurial.error.RepoError, e:
+ gdialog.Prompt(_('Invalid Revision'), str(e), self).run()
+ self.revEntry.grab_focus()
+ return
|
@@ -100,7 +100,7 @@ self.set_status_text(msg)
self._timeout_event = gobject.timeout_add(timeout, self._pulse_timer)
- def end(self, msg=_('Done'), unmap=True):
+ def end(self, msg='', unmap=True):
gobject.source_remove(self._timeout_event)
self.set_status_text(msg)
if unmap:
@@ -318,3 +318,60 @@ if response == gtk.RESPONSE_OK:
return fname
return None
+
+def addspellcheck(textview, ui=None):
+ lang = None
+ if ui:
+ lang = ui.config('tortoisehg', 'spellcheck', None)
+ try:
+ import gtkspell
+ gtkspell.Spell(textview, lang)
+ except ImportError:
+ pass
+ else:
+ def selectlang(senderitem):
+ from hggtk import dialog
+ spell = gtkspell.get_from_text_view(textview)
+ lang = ''
+ while True:
+ msg = _('Select language for spell checking.\n\n'
+ 'Empty is for the default language.\n'
+ 'When all text is highlited, the dictionary\n'
+ 'is probably not installed.\n\n'
+ 'examples: en, en_GB, en_US')
+ if lang:
+ msg = _('Lang "%s" can not be set.\n') % lang + msg
+ lang = dialog.entry_dialog(None, msg)
+ if lang is None: # cancel
+ return
+ lang = lang.strip()
+ if not lang:
+ lang = None # set default language from $LANG
+ try:
+ spell.set_language(lang)
+ return
+ except Exception, e:
+ pass
+ def langmenu(textview, menu):
+ item = gtk.MenuItem(_('Spell Check Language'))
+ item.connect('activate', selectlang)
+ menuitems = menu.get_children()[:2]
+ x = menuitems[0].get_submenu()
+ if len(menuitems) >= 2 and menuitems[1].get_child() is None and menuitems[0].get_submenu():
+ # the spellcheck language menu seems to be at the top
+ menu.insert(item, 1)
+ else:
+ sep = gtk.SeparatorMenuItem()
+ sep.show()
+ menu.append(sep)
+ menu.append(item)
+ item.show()
+ textview.connect('populate-popup', langmenu)
+
+def hasspellcheck():
+ try:
+ import gtkspell
+ gtkspell.Spell
+ return True
+ except ImportError:
+ return False
|
@@ -224,24 +224,13 @@ self._ccbox.child.set_text(hglib.fromutf(repo.ui.config('email', 'cc', '')))
self._frombox.child.set_text(hglib.fromutf(repo.ui.config('email', 'from', '')))
self._subjbox.child.set_text(hglib.fromutf(repo.ui.config('email', 'subject', '')))
- self._intro = False
- self._in_reply_to = False
- for arg in extensions.find('patchbomb').cmdtable['email'][1]:
- if arg[1] == 'intro':
- self._intro = True
- elif arg[1] == 'in-reply-to':
- self._in_reply_to = True
- if self._intro:
- addtip = ''
- else:
- addtip = ' ' + _('The description field is unused '
- 'when sending a single patch.')
self.tooltips.set_tip(self._eventbox,
_('Patch series description is sent in initial summary'
' email with [PATCH 0 of N] subject. It should describe'
' the effects of the entire patch series. When emailing'
' a bundle, these fields make up the message subject and body.')
- + addtip)
+ )
+ gtklib.addspellcheck(self.descview, self.repo.ui)
fill_history(history, self._tolist, 'email.to')
fill_history(history, self._cclist, 'email.cc')
fill_history(history, self._fromlist, 'email.from')
@@ -354,12 +343,12 @@ if self._inline.get_active(): cmdline += ['--inline']
if self._attach.get_active(): cmdline += ['--attach']
if self._diffstat.get_active(): cmdline += ['--diffstat']
- if inreplyto and self._in_reply_to:
+ if inreplyto:
cmdline += ['--in-reply-to', inreplyto]
start = self.descbuffer.get_start_iter()
end = self.descbuffer.get_end_iter()
desc = self.descbuffer.get_text(start, end)
- if desc and self._intro:
+ if desc:
cmdline += ['--intro']
tmpfile = None
try:
|
|
|
@@ -15,120 +15,101 @@
from hggtk import dialog, gtklib
-class InitDialog(gtk.Window):
+class InitDialog(gtk.Dialog):
""" Dialog to initialize a Mercurial repo """
def __init__(self, repos=[]):
""" Initialize the Dialog """
- gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
+ gtk.Dialog.__init__(self, title=_('Create a new repository'),
+ buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
gtklib.set_tortoise_icon(self, 'menucreaterepos.ico')
gtklib.set_tortoise_keys(self)
+ self.set_resizable(False)
+ self.set_has_separator(False)
- # set dialog title and icon
+ # add create button
+ createbutton = gtk.Button(_('Create'))
+ createbutton.connect('clicked', lambda b: self.init())
+ self.action_area.pack_end(createbutton)
+
self.cwd = os.getcwd()
- title = 'hg init - %s' % hglib.toutf(self.cwd)
- self.set_title(title)
# preconditioning info
- self._dest_path = os.path.abspath(repos and repos[0] or os.getcwd())
+ self.dest_path = os.path.abspath(repos and repos[0] or self.cwd)
- # build dialog
- self._create()
-
-
- def _create(self):
- self.set_default_size(350, 130)
- self.set_title(_('Create a new repository'))
-
- vbox = gtk.VBox()
- self.add(vbox)
+ # copy from 'thgconfig.py'
+ table = gtk.Table(1, 2)
+ self.vbox.pack_start(table, True, True, 2)
+ def addrow(*widgets):
+ row = table.get_property('n-rows')
+ table.set_property('n-rows', row + 1)
+ if len(widgets) == 1:
+ col = table.get_property('n-columns')
+ table.attach(widgets[0], 0, col, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 2, 2)
+ else:
+ for col, widget in enumerate(widgets):
+ flag = gtk.FILL if col == 0 else gtk.FILL|gtk.EXPAND
+ table.attach(widget, col, col + 1, row, row + 1, flag, 0, 4, 2)
# init destination
- srcbox = gtk.HBox()
lbl = gtk.Label(_('Destination:'))
- srcbox.pack_start(lbl, False, False, 2)
- self._dest_input = gtk.Entry()
- self._dest_input.set_text(hglib.toutf(self._dest_path))
- srcbox.pack_start(self._dest_input, True, True)
+ destbox = gtk.HBox()
+ self.destentry = gtk.Entry()
+ self.destentry.set_size_request(260, -1)
+ self.destentry.size_request()
+ self.destentry.set_text(hglib.toutf(self.dest_path))
+ self.destentry.grab_focus()
+ self.destentry.set_position(-1)
+ self.destentry.connect('activate', lambda b: self.init())
+ destbox.pack_start(self.destentry, True, True, 2)
- self._btn_dest_browse = gtk.Button("...")
- self._btn_dest_browse.connect('clicked', self._btn_dest_clicked)
- srcbox.pack_end(self._btn_dest_browse, False, False, 5)
+ destbrowse = gtk.Button(_('Browse...'))
+ destbrowse.connect('clicked', self.dest_clicked)
+ destbox.pack_start(destbrowse, False, False, 2)
- vbox.pack_start(srcbox, False, False, 2)
- self._dest_input.grab_focus()
- self._dest_input.set_position(-1)
+ addrow(lbl, destbox)
# options
- option_box = gtk.VBox()
- self._opt_specialfiles = gtk.CheckButton(
+ self.optspfiles = gtk.CheckButton(
_('Add special files (.hgignore, ...)'))
- self._opt_oldrepoformat = gtk.CheckButton(
+ self.optoldrepo = gtk.CheckButton(
_('Make repo compatible with Mercurial 1.0'))
- option_box.pack_start(self._opt_specialfiles, False, False)
- option_box.pack_start(self._opt_oldrepoformat, False, False)
- vbox.pack_start(option_box, False, False, 15)
+ addrow(self.optspfiles)
+ addrow(self.optoldrepo)
# set option states
- self._opt_specialfiles.set_active(True)
+ self.optspfiles.set_active(True)
try:
usefncache = ui.ui().configbool('format', 'usefncache', True)
- self._opt_oldrepoformat.set_active(not usefncache)
+ self.optoldrepo.set_active(not usefncache)
except:
pass
- # buttons at bottom
- hbbox = gtk.HButtonBox()
- hbbox.set_layout(gtk.BUTTONBOX_END)
- vbox.pack_start(hbbox, False, False, 2)
-
- close = gtk.Button(_('Close'))
- close.connect('clicked', lambda x: self.destroy())
- accelgroup = gtk.AccelGroup()
- self.add_accel_group(accelgroup)
- key, modifier = gtk.accelerator_parse('Escape')
- close.add_accelerator('clicked', accelgroup, key, 0,
- gtk.ACCEL_VISIBLE)
- hbbox.add(close)
-
- create = gtk.Button(_('Create'))
- create.connect('clicked', self._btn_init_clicked)
- mod = gtklib.get_thg_modifier()
- key, modifier = gtk.accelerator_parse(mod+'Return')
- create.add_accelerator('clicked', accelgroup, key, modifier,
- gtk.ACCEL_VISIBLE)
- hbbox.add(create)
-
- self._dest_input.connect('activate', self._entry_dest_activated, create)
-
- def _entry_dest_activated(self, entry, button):
- self._btn_init_clicked(button)
-
- def _btn_dest_clicked(self, button):
- """ select source folder to clone """
+ def dest_clicked(self, button):
+ """ select destination folder to clone """
response = gtklib.NativeFolderSelectDialog(
initial=self.cwd,
- title='Select Destination Folder').run()
+ title=_('Select Destination Folder')).run()
if response:
- self._dest_input.set_text(response)
- self._dest_input.set_position(-1)
+ self.destentry.set_text(response)
+ self.destentry.set_position(-1)
- def _btn_init_clicked(self, button, data=None):
+ def init(self):
# gather input data
- dest = hglib.fromutf(self._dest_input.get_text())
+ dest = hglib.fromutf(self.destentry.get_text())
# verify input
if dest == "":
dialog.error_dialog(self, _('Destination path is empty'),
_('Please enter the directory path'))
- self._dest_input.grab_focus()
+ self.destentry.grab_focus()
return False
# start
u = ui.ui()
# fncache is the new default repo format in Mercurial 1.1
- if self._opt_oldrepoformat.get_active():
+ if self.optoldrepo.get_active():
u.setconfig('format', 'usefncache', 'False')
try:
@@ -150,7 +131,7 @@ # create the .hg* file, mainly to workaround
# Explorer's problem in creating files with name
# begins with a dot.
- if self._opt_specialfiles.get_active():
+ if self.optspfiles.get_active():
hgignore = os.path.join(dest, '.hgignore')
if not os.path.exists(hgignore):
try:
@@ -163,5 +144,8 @@ dialog.info_dialog(self, _('New repository created'),
_('in directory %s') % hglib.toutf(os.path.abspath(dest)))
+ close = [b for b in self.action_area if b.get_label() == 'gtk-close'][0]
+ close.grab_focus()
+
def run(ui, *pats, **opts):
return InitDialog(pats)
|
@@ -430,7 +430,7 @@
? - display help'''
- if not hglib.calliffunc(ui.interactive):
+ if not ui.interactive():
raise util.Abort(_('shelve can only be run interactively'))
forced = opts['force'] or opts['append']
@@ -502,12 +502,7 @@ if dopatch:
ui.debug(_('applying patch\n'))
ui.debug(fp.getvalue())
- if patch.patchfile.__bases__:
- # Mercurial 1.3
- patch.internalpatch(fp, ui, 1, repo.root, eolmode=None)
- else:
- # Mercurial 1.2
- patch.internalpatch(fp, ui, 1, repo.root)
+ patch.internalpatch(fp, ui, 1, repo.root, eolmode=None)
del fp
# 3c. apply filtered patch to clean repo (shelve)
|
@@ -24,14 +24,8 @@ main thread to pickup.
'''
def __init__(self, src=None, outputq=None, errorq=None, dialogq=None,
- responseq=None, parentui=None):
- if parentui:
- # Mercurial 1.2
- super(GtkUi, self).__init__(parentui=parentui)
- src = parentui
- else:
- # Mercurial 1.3
- super(GtkUi, self).__init__(src)
+ responseq=None):
+ super(GtkUi, self).__init__(src)
if src:
self.outputq = src.outputq
self.errorq = src.errorq
@@ -57,28 +51,34 @@ pass
def prompt(self, msg, choices=None, default="y"):
- import re
- if not hglib.calliffunc(self.interactive): return default
- if isinstance(choices, str):
- pat = choices
- choices = None
- else:
- pat = None
- while True:
- try:
- # send request to main thread, await response
- self.dialogq.put( (msg, True, choices, default) )
- r = self.responseq.get(True)
- if r is None:
- raise EOFError
- if not r:
- return default
- if not pat or re.match(pat, r):
- return r
- else:
- self.write(_('unrecognized response\n'))
- except EOFError:
- raise util.Abort(_('response expected'))
+ if not self.interactive(): return default
+ try:
+ # send request to main thread, await response
+ self.dialogq.put( (msg, True, choices, default) )
+ r = self.responseq.get(True)
+ if r is None:
+ raise EOFError
+ if not r:
+ return default
+ if choices:
+ # return char for Mercurial 1.3
+ choice = choices[r]
+ return choice[choice.index("&")+1].lower()
+ return r
+ except EOFError:
+ raise util.Abort(_('response expected'))
+
+ def promptchoice(self, msg, choices, default=0):
+ if not self.interactive(): return default
+ try:
+ # send request to main thread, await response
+ self.dialogq.put( (msg, True, choices, default) )
+ r = self.responseq.get(True)
+ if r is None:
+ raise EOFError
+ return r
+ except EOFError:
+ raise util.Abort(_('response expected'))
def getpass(self, prompt=None, default=None):
# send request to main thread, await response
@@ -143,7 +143,7 @@ if response_id == gtk.RESPONSE_DELETE_EVENT:
self.responseq.put(None)
else:
- self.responseq.put(chr(response_id))
+ self.responseq.put(response_id)
def dialog_response(self, dialog, response_id):
if response_id == gtk.RESPONSE_OK:
@@ -155,26 +155,9 @@
def run(self):
try:
- ret = None
- if hasattr(self.ui, 'copy'):
- # Mercurial 1.3
- for k, v in self.ui.configitems('defaults'):
- self.ui.setconfig('defaults', k, '')
- ret = hglib.dispatch._dispatch(self.ui, self.args)
- else:
- # Mercurial 1.2
- # Some commands create repositories, and thus must create
- # new ui() instances. For those, we monkey-patch ui.ui()
- # as briefly as possible.
- origui = None
- if self.args[0] in ('clone', 'init'):
- origui = ui.ui
- ui.ui = GtkUi
- try:
- ret = hglib.thgdispatch(self.ui, None, self.args)
- finally:
- if origui:
- ui.ui = origui
+ for k, v in self.ui.configitems('defaults'):
+ self.ui.setconfig('defaults', k, '')
+ ret = hglib.dispatch._dispatch(self.ui, self.args)
if ret:
self.ui.write(_('[command returned code %d]\n') % int(ret))
else:
@@ -186,7 +169,5 @@ self.ui.write_err(_('abort: ') + str(e) + '\n')
except (hglib.RepoError, urllib2.HTTPError), e:
self.ui.write_err(str(e) + '\n')
- except Exception, e:
+ except (Exception, OSError, IOError), e:
self.ui.write_err(str(e) + '\n')
- except hglib.WinIOError, e:
- self.ui.write_err(str(e) + '\n')
|
|
|
@@ -57,17 +57,20 @@ opts = {}
opts['cmd'] = ' '.join(sys.argv[1:])
opts['error'] = error
+ opts['nofork'] = True
if gtkmainalive:
dlg = run(u, **opts)
dlg.display()
dlg.show_all()
else:
- gtkrun(run(u, **opts))
+ gtkrun(run, u, **opts)
-def portable_fork():
- if 'THG_HGTK_SPAWN' in os.environ or '--nofork' in sys.argv:
+def portable_fork(ui, opts):
+ if 'THG_HGTK_SPAWN' in os.environ:
return
- if '--repository' in sys.argv or '-R' in sys.argv:
+ if opts.get('nofork') or opts.get('repository'):
+ return
+ if not ui.configbool('tortoisehg', 'hgtkfork', True):
return
# Spawn background process and exit
if hasattr(sys, "frozen"):
@@ -165,11 +168,6 @@def _runcatch(ui, args):
try:
try:
- checkhgversion(hglib.hgversion)
- except util.Abort, inst:
- ui.status(_("abort: %s!\n") % inst)
- return 0
- try:
return runcommand(ui, args)
finally:
ui.flush()
@@ -206,10 +204,12 @@ path = ui.expandpath(options['repository'])
cmdoptions['repository'] = path
os.chdir(path)
+ if options['nofork']:
+ cmdoptions['nofork'] = True
path = paths.find_root(os.getcwd())
if path:
try:
- lui = hasattr(_ui, 'copy') and _ui.copy() or _ui.ui(ui)
+ lui = ui.copy()
lui.readconfig(os.path.join(path, ".hg", "hgrc"))
except IOError:
pass
@@ -226,6 +226,9 @@ extsetup()
_loaded[name] = 1
+ if options['quiet']:
+ ui.quiet = True
+
if cmd not in nonrepo_commands.split() and not path:
raise hglib.RepoError(_("There is no Mercurial repository here"
" (.hg not found)"))
@@ -245,7 +248,11 @@ if mainwindow.should_live(): return
mainwindow.destroy()
-def gtkrun(win):
+def gtkrun(dlgfunc, ui, *args, **opts):
+ portable_fork(ui, opts)
+ win = dlgfunc(ui, *args, **opts)
+ if not win:
+ return
global mainwindow, gtkmainalive
mainwindow = win
if hasattr(win, 'display'):
@@ -264,7 +271,7 @@def about(ui, *pats, **opts):
"""about TortoiseHg"""
from hggtk.about import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def add(ui, *pats, **opts):
"""add files"""
@@ -279,21 +286,11 @@
def clone(ui, *pats, **opts):
"""clone tool"""
- portable_fork()
from hggtk.clone import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def commit(ui, *pats, **opts):
"""commit tool"""
- ct = ui.config('tortoisehg', 'extcommit', None)
- if ct == 'qct':
- from mercurial import dispatch as _dispatch
- try:
- _dispatch.dispatch([ct], *pats)
- except SystemExit:
- pass
- return
- portable_fork()
# move cwd to repo root if repo is merged, so we can show
# all the changed files
repo = hg.repository(ui, path=paths.find_root())
@@ -301,130 +298,117 @@ os.chdir(repo.root)
pats = []
from hggtk.commit import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def shelve(ui, *pats, **opts):
"""shelve/unshelve tool"""
- portable_fork()
from hggtk.thgshelve import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def userconfig(ui, *pats, **opts):
"""user configuration editor"""
- # Import thgconfig first, to check for iniparse
from hggtk.thgconfig import run
- portable_fork()
opts['repomode'] = False
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def repoconfig(ui, *pats, **opts):
"""repository configuration editor"""
- portable_fork()
from hggtk.thgconfig import run
opts['repomode'] = True
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def rename(ui, *pats, **opts):
"""rename a single file or directory"""
- portable_fork()
+ if not pats or len(pats) > 2:
+ from hggtk import gdialog
+ gdialog.Prompt(_('Rename error'),
+ _('rename takes one or two path arguments'), None).run()
+ return
from hggtk.rename import run
- if not pats or len(pats) > 2:
- raise util.Abort(_('rename takes one or two path arguments'))
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def guess(ui, *pats, **opts):
"""guess previous renames or copies"""
- portable_fork()
from hggtk.guess import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def datamine(ui, *pats, **opts):
"""repository search and annotate tool"""
- portable_fork()
from hggtk.datamine import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def hgignore(ui, *pats, **opts):
"""ignore filter editor"""
- portable_fork()
from hggtk.hgignore import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def hginit(ui, *pats, **opts):
"""repository initialization tool"""
- portable_fork()
from hggtk.hginit import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def log(ui, *pats, **opts):
"""changelog viewer"""
- portable_fork()
from hggtk.history import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def merge(ui, *pats, **opts):
"""merge tool"""
- portable_fork()
from hggtk.merge import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def recovery(ui, *pats, **opts):
"""recover, rollback & verify"""
- portable_fork()
from hggtk.recovery import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def remove(ui, *pats, **opts):
"""file status viewer in remove mode"""
- portable_fork()
from hggtk.status import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def revert(ui, *pats, **opts):
"""file status viewer in revert mode"""
- portable_fork()
from hggtk.status import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
+
+def forget(ui, *pats, **opts):
+ """file status viewer in forget mode"""
+ from hggtk.status import run
+ gtkrun(run, ui, *pats, **opts)
def serve(ui, *pats, **opts):
"""web server"""
- portable_fork()
from hggtk.serve import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def status(ui, *pats, **opts):
- """file status viewer"""
- portable_fork()
+ """file status & diff viewer"""
from hggtk.status import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def synch(ui, *pats, **opts):
"""repository synchronization tool"""
- portable_fork()
from hggtk.synch import run
cmd = opts['alias']
if cmd in ('push', 'outgoing', 'email'):
opts['pushmode'] = True
else:
opts['pushmode'] = False
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def update(ui, *pats, **opts):
"""update/checkout tool"""
- portable_fork()
from hggtk.update import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def vdiff(ui, *pats, **opts):
"""launch configured visual diff tool"""
- portable_fork()
from hggtk.visdiff import run, rawextdiff
if opts.get('raw'):
rawextdiff(ui, *pats, **opts)
return
- dlg = run(ui, *pats, **opts)
- if dlg:
- gtkrun(dlg)
+ gtkrun(run, ui, *pats, **opts)
### help management, adapted from mercurial.commands.help_()
def help_(ui, name=None, with_version=False, alias=None):
@@ -464,7 +448,7 @@ aliases, i = cmdutil.findcmd(name, table, False)
except hglib.AmbiguousCommand, inst:
select = lambda c: c.lstrip('^').startswith(inst.args[0])
- helplist('list of commands:\n\n', select)
+ helplist(_('list of commands:\n\n'), select)
return
# synopsis
@@ -591,26 +575,6 @@ else:
ui.write("%s\n" % first)
-def checkhgversion(v):
- """range check the Mercurial version"""
- # this is a series of hacks, but Mercurial's versioning scheme
- # doesn't lend itself to a "correct" solution. This will at least
- # catch people who have old Mercurial packages.
- reqver = ['1', '2']
- if not v or v == 'unknown' or len(v) >= 12:
- # can't make any intelligent decisions about unknown or hashes
- return
- vers = v.split('.')[:2]
- if vers == reqver or len(vers) < 2:
- return
- nextver = list(reqver)
- nextver[1] = chr(ord(reqver[1])+1)
- if vers == nextver:
- return
- raise util.Abort(_('This version of TortoiseHg requires Mercurial '
- 'version %s.n to %s.n, but finds %s') % ('.'.join(reqver),
- '.'.join(nextver), v))
-
def version(ui, **opts):
"""output version and copyright information"""
ui.write(_('TortoiseHg Dialogs (version %s), '
@@ -640,14 +604,20 @@ cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
ui.write("%s\n" % "\n".join(sorted(cmdlist)))
+def archive(ui, *pats, **opts):
+ """create an unversioned archive of a repository revision"""
+ from hggtk.archive import run
+ gtkrun(run, ui, *pats, **opts)
+
globalopts = [
('R', 'repository', '',
_('repository root directory or symbolic path name')),
('v', 'verbose', None, _('enable additional output')),
+ ('q', 'quiet', None, _('suppress output')),
('h', 'help', None, _('display help and exit')),
('', 'debugger', None, _('start debugger')),
('', 'nofork', None, _('do not fork GUI process')),
- ('l', 'listfile', '', _('read file list from file')),
+ ('', 'listfile', '', _('read file list from file')),
]
table = {
@@ -670,7 +640,7 @@ "^recovery|rollback|verify": (recovery, [], _('hgtk recovery')),
"^shelve|unshelve": (shelve, [], _('hgtk shelve')),
"^synch|pull|push|incoming|outgoing|email": (synch, [], _('hgtk synch')),
- "^status|st": (status,
+ "^status|st|diff": (status,
[('r', 'rev', [], _('revisions to compare'))],
_('hgtk status [FILE]...')),
"^userconfig": (userconfig, [], _('hgtk userconfig')),
@@ -679,6 +649,7 @@ "^remove|rm": (revert, [], _('hgtk remove [FILE]...')),
"^rename|mv": (rename, [], _('hgtk rename SOURCE [DEST]')),
"^revert": (revert, [], _('hgtk revert [FILE]...')),
+ "^forget": (forget, [], _('hgtk forget [FILE]...')),
"^serve":
(serve,
[('', 'webdir-conf', '', _('name of the webdir config file'))],
@@ -706,4 +677,7 @@ [('o', 'options', None, _('show the command options'))],
_('[-o] CMD')),
"help": (help_, [], _('hgtk help [COMMAND]')),
+ "^archive": (archive,
+ [('r', 'rev', '', _('revision to update'))],
+ ('hgtk archive')),
}
|
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
@@ -73,7 +73,7 @@ ascent = pango.PIXELS(metrics.get_ascent())
descent = pango.PIXELS(metrics.get_descent())
- self._box_size = ascent + descent + 6
+ self._box_size = ascent + descent
return self._box_size
def set_colour(self, ctx, colour, bg, fg):
|
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
This file's diff was not loaded because this changeset is very large. Load changes Loading... |
Loading...