Changeset db36d1f7e96a…
Parent 61482ea34fd0…
by
Changes to 64 files · Browse files at db36d1f7e96a Showing diff from parent 61482ea34fd0 Diff from another changeset...
@@ -35,13 +35,13 @@ pfile = pfile[:-1]
path = os.path.dirname(os.path.dirname(os.path.realpath(pfile)))
thgpath = os.path.normpath(path)
- testpath = os.path.join(thgpath, 'thgutil')
+ testpath = os.path.join(thgpath, 'tortoisehg')
if os.path.isdir(testpath) and thgpath not in sys.path:
sys.path.insert(0, thgpath)
_thg_path()
-from thgutil import paths, debugthg, hglib, cachethg
-from hggtk import gtklib
+from tortoisehg.util import paths, debugthg, hglib, cachethg
+from tortoisehg.hgtk import gtklib
if debugthg.debug('N'):
debugf = debugthg.debugf
@@ -62,7 +62,7 @@ self.allvfs = {}
self.inv_dirs = set()
- from thgutil import menuthg
+ from tortoisehg.util import menuthg
self.hgtk = paths.find_in_path('hgtk')
self.menu = menuthg.menuThg()
self.notify = os.path.expanduser('~/.tortoisehg/notify')
|
@@ -35,7 +35,7 @@ # Fix for nautilus python extensions in lib64 on x86_64
sed -i "s,lib/nautilus,%{_lib}/nautilus,g" setup.py
-cat > thgutil/config.py << EOT
+cat > tortoisehg/util/config.py << EOT
bin_path = "%{_bindir}"
license_path = "%{_docdir}/%{name}-%{version}/COPYING.txt"
locale_path = "%{_datadir}/locale"
@@ -62,8 +62,8 @@%defattr(-,root,root,-)
%doc COPYING.txt ReleaseNotes.txt doc/build/html/
%{_bindir}/hgtk
-%{python_sitelib}/hggtk/
-%{python_sitelib}/thgutil/
+%{python_sitelib}/tortoisehg/hgtk/
+%{python_sitelib}/tortoisehg/util/
%{python_sitelib}/tortoisehg-*.egg-info
%{_datadir}/pixmaps/tortoisehg/
%{_datadir}/locale/*/LC_MESSAGES/tortoisehg.mo
|
|
@@ -1,73 +0,0 @@ - # rename.py - TortoiseHg's dialogs for handling renames
-#
-# Copyright 2009 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 sys
-import gtk
-import cStringIO
-
-from mercurial import hg, ui, util, commands
-
-from thgutil.i18n import _
-from thgutil import hglib, paths
-
-from hggtk import dialog
-
-def run(ui, *pats, **opts):
- fname, target = '', ''
- try:
- fname = pats[0]
- target = pats[1]
- except IndexError:
- pass
- fname = util.normpath(fname)
- if target:
- target = hglib.toutf(util.normpath(target))
- else:
- target = hglib.toutf(fname)
- title = _('Rename ') + hglib.toutf(fname)
- dlg = dialog.entry_dialog(None, title, True, target, rename_resp)
- dlg.orig = fname
- return dlg
-
-def rename_resp(dlg, response):
- if response != gtk.RESPONSE_OK:
- dlg.destroy()
- return
- try:
- root = paths.find_root()
- repo = hg.repository(ui.ui(), root)
- except (ImportError, hglib.RepoError):
- dlg.destroy()
- return
-
- new_name = hglib.fromutf(dlg.entry.get_text())
- opts = {}
- opts['force'] = False # Checkbox? Nah.
- opts['after'] = False
- opts['dry_run'] = False
-
- saved = sys.stderr
- errors = cStringIO.StringIO()
- toquit = False
- try:
- sys.stderr = errors
- repo.ui.pushbuffer()
- repo.ui.quiet = True
- try:
- commands.rename(repo.ui, repo, dlg.orig, new_name, **opts)
- toquit = True
- except (util.Abort, hglib.RepoError), inst:
- dlg.error_dialog(None, _('rename error'), str(inst))
- toquit = False
- finally:
- sys.stderr = saved
- textout = errors.getvalue() + repo.ui.popbuffer()
- errors.close()
- if len(textout) > 1:
- dlg.error_dialog(None, _('rename error'), textout)
- elif toquit:
- dlg.destroy()
|
@@ -11,13 +11,13 @@
if hasattr(sys, "frozen"):
# Prepend C:\Program Files\TortoiseHg\gtk (equiv) to the path
- from thgutil import paths
+ from tortoisehg.util import paths
gtkpath = os.path.join(paths.bin_path, 'gtk')
os.environ['PATH'] = os.pathsep.join([gtkpath, os.environ['PATH']])
else:
# if hgtk is a symlink, insert symlink target directory in sys.path
thgpath = os.path.dirname(os.path.realpath(__file__))
- testpath = os.path.join(thgpath, 'thgutil')
+ testpath = os.path.join(thgpath, 'tortoisehg')
if os.path.isdir(testpath) and thgpath not in sys.path:
sys.path.insert(0, thgpath)
@@ -30,14 +30,14 @@demandimport.ignore.append('win32com.shell')
demandimport.enable()
from mercurial import ui, util
-from thgutil.hgversion import hgversion, checkhgversion
+from tortoisehg.util.hgversion import hgversion, checkhgversion
import cStringIO
import traceback
try:
- import hggtk.hgtk
+ import tortoisehg.hgtk.hgtk
except ImportError:
- sys.stderr.write("abort: couldn't find hggtk libraries in [%s]\n" %
+ sys.stderr.write("abort: couldn't find hgtk libraries in [%s]\n" %
';'.join(sys.path))
sys.stderr.write("(check your install and PYTHONPATH)\n")
sys.exit(-1)
@@ -51,19 +51,19 @@ sys.exit(1)
if not capt or 'THGDEBUG' in os.environ:
- sys.exit(hggtk.hgtk.dispatch(sys.argv[1:]))
+ sys.exit(tortoisehg.hgtk.hgtk.dispatch(sys.argv[1:]))
else:
mystderr = cStringIO.StringIO()
origstderr = sys.stderr
sys.stderr = mystderr
try:
- ret = hggtk.hgtk.dispatch(sys.argv[1:])
+ ret = tortoisehg.hgtk.hgtk.dispatch(sys.argv[1:])
sys.stderr = origstderr
mystderr.seek(0)
for l in mystderr.readlines():
if l.startswith('Traceback') or l.startswith('TypeError'):
- from hggtk.bugreport import run
- from hggtk.hgtk import gtkrun
+ from tortoisehg.hgtk.bugreport import run
+ from tortoisehg.hgtk.hgtk import gtkrun
error = 'Recoverable runtime error (stderr):\n'
error += mystderr.getvalue()
opts = {}
|
@@ -56,7 +56,8 @@ # Specific definitios for Windows NT-alike installations
_scripts = []
_data_files = []
- _packages = ['hggtk', 'hggtk.logview', 'thgutil']
+ _packages = ['tortoisehg.hgtk', 'tortoisehg.hgtk.logview',
+ 'tortoisehg.util']
extra = {}
hgextmods = []
@@ -128,7 +129,8 @@ # Specific definitios for Posix installations
_extra = {}
_scripts = ['hgtk']
- _packages = ['hggtk', 'hggtk.logview', 'thgutil']
+ _packages = ['tortoisehg.hgtk', 'tortoisehg.hgtk.logview',
+ 'tortoisehg.util']
_data_files = [(os.path.join('share/pixmaps/tortoisehg', root),
[os.path.join(root, file_) for file_ in files])
for root, dirs, files in os.walk('icons')]
@@ -139,7 +141,7 @@ ['contrib/nautilus-thg.py'])]
# Create a config.py. Distributions will need to supply their own
- cfgfile = os.path.join('thgutil', 'config.py')
+ cfgfile = os.path.join('tortoisehg', 'util', 'config.py')
if not os.path.exists(cfgfile) and not os.path.exists('.hg/requires'):
f = open(cfgfile, "w")
f.write('bin_path = "/usr/bin"\n')
@@ -168,15 +170,15 @@except OSError:
version = "unknown"
-verfile = os.path.join("thgutil", "__version__.py")
+verfile = os.path.join('tortoisehg', 'util', '__version__.py')
if version != 'unknown' or not os.path.exists(verfile):
f = file(verfile, "w")
f.write('# this file is autogenerated by setup.py\n')
f.write('version = "%s"\n' % version)
f.close()
else:
- import thgutil.__version__
- version = thgutil.__version__.version
+ import tortoisehg.util.__version__
+ version = tortoisehg.util.__version__.version
setup(name="tortoisehg",
version=version,
|
@@ -24,12 +24,11 @@ demandimport.ignore.append('win32com.shell')
demandimport.enable()
from mercurial import ui, error
-from thgutil.i18n import agettext as _
-from thgutil import thread2, paths, shlib
+from tortoisehg.util.i18n import agettext as _
+from tortoisehg.util import thread2, paths, shlib
if hasattr(sys, "frozen"):
# Insert PATH to binary installer gtk directory
- from thgutil import paths
gtkpath = os.path.join(paths.bin_path, 'gtk')
os.environ['PATH'] = os.pathsep.join([gtkpath, os.environ['PATH']])
# Give stdout/stderr closed attributes to prevent ui.py errors
@@ -45,7 +44,7 @@ # Try and find a custom icon
print "SetIcon(%s)" % name
hinst = GetModuleHandle(None)
- from thgutil.paths import get_tortoise_icon
+ from tortoisehg.util.paths import get_tortoise_icon
iconPathName = get_tortoise_icon(name)
if iconPathName and os.path.isfile(iconPathName):
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
@@ -172,7 +171,7 @@ def launchgui(self):
def launch():
import gtk
- from hggtk import taskbarui, hgtk
+ from tortoisehg.hgtk import taskbarui
dlg = taskbarui.TaskBarUI(logger.getqueue(), requests)
dlg.show_all()
dlg.connect('destroy', gtk.main_quit)
|
@@ -11,10 +11,10 @@ import gtk
import threading
-from thgutil.i18n import _
-from thgutil import version, paths, hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import version, paths, hglib
-from hggtk import gtklib, hgtk
+from tortoisehg.hgtk import gtklib, hgtk
def browse_url(url):
def start_browser():
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui
-from thgutil.i18n import _
-from thgutil import hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
-from hggtk import hgcmd, gtklib
+from tortoisehg.hgtk import hgcmd, gtklib
_working_dir_parent_ = _('= Working Directory Parent =')
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui
-from thgutil.i18n import _
-from thgutil import hglib, paths, i18n, settings
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths, i18n, settings
-from hggtk import changesetinfo, gtklib, hgcmd, gdialog
+from tortoisehg.hgtk import changesetinfo, gtklib, hgcmd, gdialog
keep = i18n.keepgettext()
|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/bugreport.py
Stacked
renamed from hggtk/bugreport.py
|
||
---|---|---|
@@ -10,9 +10,9 @@ import pango
from mercurial import extensions
-from thgutil.i18n import _
-from thgutil import hglib, version
-from hggtk import gdialog
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, version
+from tortoisehg.hgtk import gdialog
class BugReport(gdialog.GDialog):
"""GTK+ based dialog for displaying traceback info to the user in a
|
Change 1 of 3
Show Entire File
tortoisehg/hgtk/changeset.py
Stacked
renamed from hggtk/changeset.py
|
||
---|---|---|
@@ -13,11 +13,11 @@
from mercurial import cmdutil, context, util, ui, hg, patch, mdiff
-from thgutil.i18n import _
-from thgutil.hglib import *
-from thgutil import shlib
+from tortoisehg.util.i18n import _
+from tortoisehg.util.hglib import *
+from tortoisehg.util import shlib
-from hggtk import gdialog, gtklib, hgcmd
+from tortoisehg.hgtk import gdialog, gtklib, hgcmd
class ChangeSet(gdialog.GDialog):
'GTK+ based dialog for displaying repository logs'
@@ -677,7 +677,7 @@
def ann_file(self, menuitem):
'User selected annotate file from the file list context menu'
- from hggtk import datamine
+ from tortoisehg.hgtk import datamine
rev = self.currev
dialog = datamine.DataMineDialog(self.ui, self.repo, self.cwd, [], {})
dialog.display()
@@ -694,7 +694,7 @@ self.glog_parent.reload_log(**opts)
else:
# Else launch our own glog instance
- from hggtk import history
+ from tortoisehg.hgtk import history
dlg = history.run(self.ui, filehist=self.curfile)
dlg.display()
|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/changesetinfo.py
Stacked
renamed from hggtk/changesetinfo.py
|
||
---|---|---|
@@ -10,10 +10,10 @@ import os
import gtk
-from thgutil.i18n import _
-from thgutil import hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib
-from hggtk import gtklib
+from tortoisehg.hgtk import gtklib
def changesetinfo(repo, revid, head=False):
def lbl(str, bold=False, right=False):
|
@@ -12,9 +12,9 @@ import traceback
from mercurial import ui, util
-from thgutil.i18n import _
-from thgutil import hglib, shlib, settings
-from hggtk import gdialog, gtklib, hgcmd
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, shlib, settings
+from tortoisehg.hgtk import gdialog, gtklib, hgcmd
class CloneDialog(gtk.Dialog):
""" Dialog to clone a Mercurial repo """
|
@@ -18,12 +18,11 @@
from mercurial import ui, hg, util, patch, cmdutil
-from thgutil.i18n import _
-from thgutil import shlib, hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import shlib, hglib
-from hggtk.status import GStatus, FM_STATUS, FM_CHECKED, FM_PATH_UTF8
-from hggtk.status import DM_REJECTED, DM_CHUNK_ID
-from hggtk import gtklib, thgconfig, gdialog, hgcmd
+from tortoisehg.hgtk.status import GStatus, FM_STATUS, FM_CHECKED, FM_PATH_UTF8
+from tortoisehg.hgtk import gtklib, thgconfig, gdialog, hgcmd
class BranchOperationDialog(gtk.Dialog):
def __init__(self, branch, close, mergebranches):
@@ -745,7 +744,7 @@
def changelog_clicked(self, toolbutton, data=None):
- from hggtk import history
+ from tortoisehg.hgtk import history
dlg = history.run(self.ui)
dlg.display()
return True
|
Change 1 of 2
Show Changes Only
tortoisehg/hgtk/datamine.py
Stacked
renamed from hggtk/datamine.py
|
||
---|---|---|
|
|
# datamine.py - Data Mining dialog for TortoiseHg
#
# Copyright 2008 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 gtk
import gobject
import os
import pango
import Queue
import threading
import re
from mercurial import util
-from thgutil.i18n import _
-from thgutil import hglib
-from thgutil import thread2
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, thread2
-from hggtk.logview.colormap import AnnotateColorMap, AnnotateColorSaturation
-from hggtk.logview.treeview import TreeView as LogTreeView
-
-from hggtk import gtklib, gdialog, changeset
+from tortoisehg.hgtk.logview.colormap import AnnotateColorMap
+from tortoisehg.hgtk.logview.colormap import AnnotateColorSaturation
+from tortoisehg.hgtk.logview.treeview import TreeView as LogTreeView
+from tortoisehg.hgtk import gtklib, gdialog, changeset
class DataMineDialog(gdialog.GDialog):
COL_REVID = 0
COL_TEXT = 1
COL_TOOLTIP = 2
COL_PATH = 3
COL_COLOR = 4
COL_USER = 5
COL_LINENUM = 6
def get_title(self):
return _('%s - DataMining') % self.get_reponame()
def get_icon(self):
return 'menurepobrowse.ico'
def parse_opts(self):
pass
def get_tbbuttons(self):
self.stop_button = self.make_toolbutton(gtk.STOCK_STOP, _('Stop'),
self.stop_current_search,
tip=_('Stop operation on current tab'))
return [
self.make_toolbutton(gtk.STOCK_FIND, _('New Search'),
self.search_clicked,
tip=_('Open new search tab')),
self.stop_button
]
def prepare_display(self):
root = self.repo.root
cf = []
for f in self.pats:
if os.path.isfile(f):
cf.append(util.canonpath(root, self.cwd, f))
elif os.path.isdir(f):
gdialog.Prompt(_('Invalid path'),
_('Cannot annotate directory: %s') % f, None).run()
for f in cf:
self.add_annotate_page(f, '.')
if not self.notebook.get_n_pages():
self.add_search_page()
os.chdir(root)
def save_settings(self):
settings = gdialog.GDialog.save_settings(self)
return settings
def load_settings(self, settings):
gdialog.GDialog.load_settings(self, settings)
self.tabwidth = hglib.gettabwidth(self.ui)
def get_body(self):
""" Initialize the Dialog. """
self.grep_cmenu = self.grep_context_menu()
self.changedesc = {}
self.newpagecount = 1
self.currev = None
vbox = gtk.VBox()
notebook = gtk.Notebook()
notebook.set_tab_pos(gtk.POS_TOP)
notebook.set_scrollable(True)
notebook.popup_enable()
notebook.show()
self.notebook = notebook
vbox.pack_start(self.notebook, True, True, 2)
accelgroup = gtk.AccelGroup()
self.add_accel_group(accelgroup)
mod = gtklib.get_thg_modifier()
key, modifier = gtk.accelerator_parse(mod+'w')
notebook.add_accelerator('thg-close', accelgroup, key,
modifier, gtk.ACCEL_VISIBLE)
notebook.connect('thg-close', self.close_notebook)
key, modifier = gtk.accelerator_parse(mod+'n')
notebook.add_accelerator('thg-new', accelgroup, key,
modifier, gtk.ACCEL_VISIBLE)
notebook.connect('thg-new', self.new_notebook)
self.stbar = gtklib.StatusBar()
self.stbar.sttext.set_property('use-markup', True)
vbox.pack_start(self.stbar, False, False, 2)
self.stop_button.set_sensitive(False)
return vbox
def _destroying(self, gtkobj):
self.stop_all_searches()
gdialog.GDialog._destroying(self, gtkobj)
def ann_header_context_menu(self, treeview):
menu = gtk.Menu()
button = gtk.CheckMenuItem(_('Filename'))
button.connect('toggled', self.toggle_annatate_columns, treeview, 2)
menu.append(button)
button = gtk.CheckMenuItem(_('User'))
button.connect('toggled', self.toggle_annatate_columns, treeview, 3)
menu.append(button)
menu.show_all()
return menu
def grep_context_menu(self):
menu = gtk.Menu()
menu.append(create_menu(_('di_splay change'), self.cmenu_display))
menu.append(create_menu(_('_annotate file'), self.cmenu_annotate))
menu.append(create_menu(_('_file history'), self.cmenu_file_log))
menu.show_all()
return menu
def annotate_context_menu(self, objs):
menu = gtk.Menu()
menu.append(create_menu(_('_zoom to change'), self.cmenu_zoom, objs))
menu.append(create_menu(_('di_splay change'), self.cmenu_display))
menu.append(create_menu(_('_annotate parent'),
self.annotate_parent, objs))
menu.show_all()
return menu
def annotate_parent(self, menuitem, objs):
if not self.currev:
return
parent = self.repo[self.currev].parents()[0].rev()
self.trigger_annotate(parent, objs)
def cmenu_zoom(self, menuitem, objs):
(frame, treeview, path, graphview) = objs
graphview.scroll_to_revision(int(self.currev))
graphview.set_revision_id(int(self.currev))
def cmenu_display(self, menuitem):
statopts = {'rev' : [self.currev] }
dlg = changeset.ChangeSet(self.ui, self.repo, self.cwd, [], statopts)
dlg.display()
def cmenu_annotate(self, menuitem):
self.add_annotate_page(self.curpath, self.currev)
def cmenu_file_log(self, menuitem):
- from hggtk import history
+ from tortoisehg.hgtk import history
dlg = history.run(self.ui, filehist=self.curpath)
dlg.display()
def grep_button_release(self, widget, event):
if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |
gtk.gdk.CONTROL_MASK)):
self.grep_popup_menu(widget, event.button, event.time)
return False
def grep_popup_menu(self, treeview, button=0, time=0):
self.grep_cmenu.popup(None, None, None, button, time)
return True
def grep_thgdiff(self, treeview):
if self.currev:
self._do_diff([], {'change' : self.currev})
def grep_row_act(self, tree, path, column):
'Default action is the first entry in the context menu'
self.grep_cmenu.get_children()[0].activate()
return True
def get_rev_desc(self, rev):
if rev in self.changedesc:
return self.changedesc[rev]
ctx = self.repo[rev]
author = hglib.toutf(util.shortuser(ctx.user()))
date = hglib.toutf(hglib.displaytime(ctx.date()))
summary = gtklib.markup_escape_text(hglib.toutf(hglib.tounicode(
ctx.description()).replace(u'\0', '').splitlines()[0]))
desc = '%s@%s %s "%s"' % (author, rev, date, summary)
self.changedesc[rev] = (desc, author)
return (desc, author)
def search_clicked(self, button, data):
self.add_search_page()
def create_tab_close_button(self):
button = gtk.Button()
iconBox = gtk.HBox(False, 0)
image = gtk.Image()
image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
gtk.Button.set_relief(button, gtk.RELIEF_NONE)
settings = gtk.Widget.get_settings(button)
(w,h) = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU)
gtk.Widget.set_size_request(button, w + 4, h + 4)
image.show()
iconBox.pack_start(image, True, False, 0)
button.add(iconBox)
iconBox.show()
return button
def close_notebook(self, notebook):
if notebook.get_n_pages() <= 1:
gtklib.thgexit(self)
else:
self.close_current_page()
def new_notebook(self, notebook):
self.add_search_page()
def add_search_page(self):
frame = gtk.Frame()
frame.set_border_width(10)
vbox = gtk.VBox()
search_hbox = gtk.HBox()
regexp = gtk.Entry()
includes = gtk.Entry()
if self.cwd.startswith(self.repo.root):
includes.set_text(util.canonpath(self.repo.root, self.cwd, '.'))
excludes = gtk.Entry()
search = gtk.Button(_('Search'))
search_hbox.pack_start(gtk.Label(_('Regexp:')), False, False, 4)
search_hbox.pack_start(regexp, True, True, 4)
search_hbox.pack_start(gtk.Label(_('Includes:')), False, False, 4)
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, 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'
' inclusion patterns. By default, the entire repository'
' is searched.'))
self.tooltips.set_tip(excludes, _('Comma separated list of'
' exclusion patterns. Exclusion patterns are applied'
' after inclusion patterns.'))
vbox.pack_start(search_hbox, False, False, 4)
hbox = gtk.HBox()
follow = gtk.CheckButton(_('Follow copies and renames'))
ignorecase = gtk.CheckButton(_('Ignore case'))
linenum = gtk.CheckButton(_('Show line numbers'))
showall = gtk.CheckButton(_('Show all matching revisions'))
hbox.pack_start(follow, False, False, 4)
hbox.pack_start(ignorecase, False, False, 4)
hbox.pack_start(linenum, False, False, 4)
hbox.pack_start(showall, False, False, 4)
vbox.pack_start(hbox, False, False, 4)
treeview = gtk.TreeView()
treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)
treeview.set_rules_hint(True)
treeview.set_property('fixed-height-mode', True)
treeview.connect("cursor-changed", self.grep_selection_changed)
treeview.connect('button-release-event', self.grep_button_release)
treeview.connect('popup-menu', self.grep_popup_menu)
treeview.connect('row-activated', self.grep_row_act)
accelgroup = gtk.AccelGroup()
self.add_accel_group(accelgroup)
mod = gtklib.get_thg_modifier()
key, modifier = gtk.accelerator_parse(mod+'d')
treeview.add_accelerator('thg-diff', accelgroup, key,
modifier, gtk.ACCEL_VISIBLE)
treeview.connect('thg-diff', self.grep_thgdiff)
results = gtk.ListStore(str, str, str, str)
treeview.set_model(results)
treeview.set_search_equal_func(self.search_in_grep)
for title, width, col, emode in (
(_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE),
(_('File'), 25, self.COL_PATH, pango.ELLIPSIZE_START),
(_('Matches'), 80, self.COL_TEXT, pango.ELLIPSIZE_END)):
cell = gtk.CellRendererText()
cell.set_property('width-chars', width)
cell.set_property('ellipsize', emode)
cell.set_property('family', 'Monospace')
column = gtk.TreeViewColumn(title)
column.set_resizable(True)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(cell.get_size(treeview)[2])
column.pack_start(cell, expand=True)
column.add_attribute(cell, 'text', col)
treeview.append_column(column)
if hasattr(treeview, 'set_tooltip_column'):
treeview.set_tooltip_column(self.COL_TOOLTIP)
scroller = gtk.ScrolledWindow()
scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroller.add(treeview)
vbox.pack_start(scroller, True, True)
frame.add(vbox)
frame.show_all()
hbox = gtk.HBox()
lbl = gtk.Label(_('Search %d') % self.newpagecount)
close = self.create_tab_close_button()
close.connect('clicked', self.close_page, frame)
hbox.pack_start(lbl, True, True, 2)
hbox.pack_start(close, False, False)
hbox.show_all()
num = self.notebook.append_page(frame, hbox)
self.newpagecount += 1
objs = (treeview.get_model(), frame, regexp, follow, ignorecase,
excludes, includes, linenum, showall, search_hbox)
# Clicking 'search' or hitting Enter in any text entry triggers search
search.connect('clicked', self.trigger_search, objs)
regexp.connect('activate', self.trigger_search, objs)
includes.connect('activate', self.trigger_search, objs)
excludes.connect('activate', self.trigger_search, objs)
# Includes/excludes must disable following copies
objs = (includes, excludes, follow)
includes.connect('changed', self.update_following_possible, objs)
excludes.connect('changed', self.update_following_possible, objs)
self.update_following_possible(includes, objs)
if hasattr(self.notebook, 'set_tab_reorderable'):
self.notebook.set_tab_reorderable(frame, True)
self.notebook.set_current_page(num)
regexp.grab_focus()
def search_in_grep(self, model, column, key, iter):
"""Searches all fields shown in the tree when the user hits crtr+f,
not just the ones that are set via tree.set_search_column.
Case insensitive
"""
key = key.lower()
for col in (self.COL_PATH, self.COL_TEXT):
if key in model.get_value(iter, col).lower():
return False
return True
def trigger_search(self, button, objs):
(model, frame, regexp, follow, ignorecase,
excludes, includes, linenum, showall, search_hbox) = objs
retext = regexp.get_text()
if not retext:
gdialog.Prompt(_('No regular expression given'),
_('You must provide a search expression'), self).run()
regexp.grab_focus()
return
try:
re.compile(retext)
except re.error, e:
gdialog.Prompt(_('Invalid regular expression'),
_('Error: %s') % str(e), self).run()
regexp.grab_focus()
return
q = Queue.Queue()
args = [self.repo.root, q, 'grep']
if follow.get_active(): args.append('--follow')
if ignorecase.get_active(): args.append('--ignore-case')
if linenum.get_active(): args.append('--line-number')
if showall.get_active(): args.append('--all')
incs = [x.strip() for x in includes.get_text().split(',')]
excs = [x.strip() for x in excludes.get_text().split(',')]
for i in incs:
if i: args.extend(['-I', i])
for x in excs:
if x: args.extend(['-X', x])
args.append(retext)
def threadfunc(path, q, *args):
try:
hglib.hgcmd_toq(path, q, *args)
except util.Abort, e:
self.stbar.set_status_text(_('Abort: %s') % str(e))
thread = thread2.Thread(target=threadfunc, args=args)
thread.start()
frame._mythread = thread
self.stop_button.set_sensitive(True)
model.clear()
search_hbox.set_sensitive(False)
self.stbar.begin()
self.stbar.set_status_text('hg ' + ' '.join(args[2:]))
hbox = gtk.HBox()
lbl = gtk.Label(_('Search "%s"') % retext.split()[0])
close = self.create_tab_close_button()
close.connect('clicked', self.close_page, frame)
hbox.pack_start(lbl, True, True, 2)
hbox.pack_start(close, False, False)
hbox.show_all()
self.notebook.set_tab_label(frame, hbox)
gobject.timeout_add(50, self.grep_wait, thread, q, model,
search_hbox, regexp, frame)
def grep_wait(self, thread, q, model, search_hbox, regexp, frame):
"""
Handle all the messages currently in the queue (if any).
"""
while q.qsize():
line = q.get(0).rstrip('\r\n')
try:
(path, revid, text) = line.split(':', 2)
except ValueError:
continue
tip, user = self.get_rev_desc(long(revid))
if self.tabwidth:
text = text.expandtabs(self.tabwidth)
model.append((revid, hglib.toutf(text[:512]), tip, hglib.toutf(path)))
if thread.isAlive():
return True
else:
if threading.activeCount() == 1:
self.stop_button.set_sensitive(False)
frame._mythread = None
search_hbox.set_sensitive(True)
regexp.grab_focus()
self.stbar.end()
return False
def grep_selection_changed(self, treeview):
"""
Callback for when the user selects grep output.
"""
(path, focus) = treeview.get_cursor()
model = treeview.get_model()
if path is not None and model is not None:
paths = model.get_iter(path)
self.currev = model[paths][self.COL_REVID]
self.curpath = hglib.fromutf(model[paths][self.COL_PATH])
self.stbar.set_status_text(hglib.toutf(model[paths][self.COL_TOOLTIP]))
def close_current_page(self):
num = self.notebook.get_current_page()
if num != -1 and self.notebook.get_n_pages():
self.notebook.remove_page(num)
def stop_current_search(self, button, widget):
num = self.notebook.get_current_page()
frame = self.notebook.get_nth_page(num)
self.stop_search(frame)
def stop_all_searches(self):
for num in xrange(self.notebook.get_n_pages()):
frame = self.notebook.get_nth_page(num)
self.stop_search(frame)
def stop_search(self, frame):
if getattr(frame, '_mythread', None):
frame._mythread.terminate()
frame._mythread.join()
frame._mythread = None
def close_page(self, button, widget):
'''Close page button has been pressed'''
num = self.notebook.page_num(widget)
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())
lb.show()
col.set_widget(lb)
wgt = lb.get_parent()
while wgt:
if type(wgt) == gtk.Button:
wgt.connect("button-press-event",
self.tree_header_button_press, menu)
break
wgt = wgt.get_parent()
def tree_header_button_press(self, widget, event, menu):
if event.button == 3:
menu.popup(None, None, None, event.button, event.time)
return True
return False
def update_following_possible(self, widget, objs):
(includes, excludes, follow) = objs
allow = not includes.get_text() and not excludes.get_text()
if not allow:
follow.set_active(False)
follow.set_sensitive(allow)
def add_annotate_page(self, path, revid):
'''
Add new annotation page to notebook. Start scan of
file 'path' revision history, start annotate of supplied
revision 'revid'.
'''
if revid == '.':
ctx = self.repo.parents()[0]
try:
fctx = ctx.filectx(path)
except LookupError:
gdialog.Prompt(_('File is unrevisioned'),
_('Unable to annotate ') + path, self).run()
return
rev = fctx.filelog().linkrev(fctx.filerev())
revid = str(rev)
else:
rev = long(revid)
frame = gtk.Frame()
frame.set_border_width(10)
vbox = gtk.VBox()
graphopts = { 'date': None, 'no_merges':False, 'only_merges':False,
'keyword':[], 'branch':None, 'pats':[], 'revrange':[],
'revlist':[], 'noheads':False, 'orig-tip':len(self.repo),
'branch-view':False, 'rev':[] }
graphopts['filehist'] = path
# File log revision graph
graphview = LogTreeView(self.repo, 5000, self.stbar)
graphview.connect('revisions-loaded', self.revisions_loaded, rev)
graphview.refresh(True, [path], graphopts)
graphview.set_property('rev-column-visible', True)
graphview.set_property('age-column-visible', True)
hbox = gtk.HBox()
followlabel = gtk.Label('')
follow = gtk.Button(_('Follow'))
follow.connect('clicked', self.follow_rename)
follow.hide()
follow.set_sensitive(False)
hbox.pack_start(gtk.Label(''), True, True)
hbox.pack_start(followlabel, False, False)
hbox.pack_start(follow, False, False)
# Annotation text tree view
treeview = gtk.TreeView()
treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)
treeview.set_property('fixed-height-mode', True)
treeview.set_border_width(0)
accelgroup = gtk.AccelGroup()
self.add_accel_group(accelgroup)
mod = gtklib.get_thg_modifier()
key, modifier = gtk.accelerator_parse(mod+'d')
treeview.add_accelerator('thg-diff', accelgroup, key,
modifier, gtk.ACCEL_VISIBLE)
treeview.connect('thg-diff', self.annotate_thgdiff)
results = gtk.ListStore(str, str, str, str, str, str, str)
treeview.set_model(results)
treeview.set_search_equal_func(self.search_in_file)
context_menu = self.ann_header_context_menu(treeview)
for title, width, col, emode, visible in (
(_('Line'), 8, self.COL_LINENUM, pango.ELLIPSIZE_NONE, True),
(_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE, True),
(_('File'), 15, self.COL_PATH, pango.ELLIPSIZE_START, False),
(_('User'), 15, self.COL_USER, pango.ELLIPSIZE_END, False),
(_('Source'), 80, self.COL_TEXT, pango.ELLIPSIZE_END, True)):
cell = gtk.CellRendererText()
cell.set_property('width-chars', width)
cell.set_property('ellipsize', emode)
cell.set_property('family', 'Monospace')
column = gtk.TreeViewColumn(title)
column.set_resizable(True)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(cell.get_size(treeview)[2])
column.pack_start(cell, expand=True)
column.add_attribute(cell, 'text', col)
column.add_attribute(cell, 'background', self.COL_COLOR)
column.set_visible(visible)
treeview.append_column(column)
self.add_header_context_menu(column, context_menu)
treeview.set_headers_clickable(True)
if hasattr(treeview, 'set_tooltip_column'):
treeview.set_tooltip_column(self.COL_TOOLTIP)
results.path = path
results.rev = revid
scroller = gtk.ScrolledWindow()
scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroller.add(treeview)
vpaned = gtk.VPaned()
vpaned.pack1(graphview, True, True)
vpaned.pack2(scroller, True, True)
vbox.pack_start(vpaned, True, True)
vbox.pack_start(hbox, False, False)
frame.add(vbox)
frame.show_all()
hbox = gtk.HBox()
lbl = gtk.Label(hglib.toutf(os.path.basename(path) + '@' + revid))
close = self.create_tab_close_button()
close.connect('clicked', self.close_page, frame)
hbox.pack_start(lbl, True, True, 2)
hbox.pack_start(close, False, False)
hbox.show_all()
num = self.notebook.append_page_menu(frame,
hbox, gtk.Label(hglib.toutf(path + '@' + revid)))
if hasattr(self.notebook, 'set_tab_reorderable'):
self.notebook.set_tab_reorderable(frame, True)
self.notebook.set_current_page(num)
graphview.connect('revision-selected', self.log_selection_changed,
path, followlabel, follow)
objs = (frame, treeview, path, graphview)
graphview.treeview.connect('row-activated', self.log_activate, objs)
graphview.treeview.connect('button-release-event',
self.ann_button_release, objs)
graphview.treeview.connect('popup-menu', self.ann_popup_menu, objs)
treeview.connect("cursor-changed", self.ann_selection_changed)
treeview.connect('button-release-event', self.ann_button_release, objs)
treeview.connect('popup-menu', self.ann_popup_menu, objs)
treeview.connect('row-activated', self.ann_row_act, objs)
def search_in_file(self, model, column, key, iter):
"""Searches all fields shown in the tree when the user hits crtr+f,
not just the ones that are set via tree.set_search_column.
Case insensitive
"""
key = key.lower()
for col in (self.COL_USER, self.COL_TEXT):
if key in model.get_value(iter, col).lower():
return False
return True
def annotate_thgdiff(self, treeview):
self._do_diff([], {'change' : self.currev})
def toggle_annatate_columns(self, button, treeview, col):
b = button.get_active()
treeview.get_column(col).set_visible(b)
def log_selection_changed(self, graphview, path, label, button):
treeview = graphview.treeview
(model, paths) = treeview.get_selection().get_selected_rows()
revid = graphview.get_revid_at_path(paths[0])
self.currev = str(revid)
ctx = self.repo[revid]
try:
filectx = ctx.filectx(path)
info = filectx.renamed()
except LookupError:
info = None
if info:
(rpath, node) = info
fl = self.repo.file(rpath)
frev = fl.linkrev(fl.rev(node))
button.set_label(hglib.toutf('%s@%s' % (rpath, frev)))
button.show()
button.set_sensitive(True)
label.set_text(_('Follow Rename:'))
else:
button.hide()
button.set_sensitive(False)
label.set_text('')
def follow_rename(self, button):
path, rev = button.get_label().rsplit('@', 1)
self.add_annotate_page(path, rev)
def log_activate(self, treeview, path, column, objs):
(frame, treeview, file, graphview) = objs
rev = graphview.get_revid_at_path(path)
self.trigger_annotate(rev, objs)
def revisions_loaded(self, graphview, rev):
graphview.set_revision_id(rev)
treeview = graphview.treeview
path, column = treeview.get_cursor()
# It's possible that the requested change was not found in the
# file's filelog history. In that case, no row will be
# selected.
if path != None and column != None:
treeview.row_activated(path, column)
def trigger_annotate(self, rev, objs):
'''
User has selected a file revision to annotate. Trigger a
background thread to perform the annotation. Disable the select
button until this operation is complete.
'''
(frame, treeview, path, graphview) = objs
q = Queue.Queue()
args = [self.repo.root, q, 'annotate', '--follow', '--number',
'--rev', str(rev), 'path:'+path]
thread = thread2.Thread(target=hglib.hgcmd_toq, args=args)
thread.start()
frame._mythread = thread
self.stop_button.set_sensitive(True)
# date of selected revision
ctx = self.repo[long(rev)]
curdate = ctx.date()[0]
# date of initial revision
fctx = self.repo.filectx(path, fileid=0)
basedate = fctx.date()[0]
agedays = (curdate - basedate) / (24 * 60 * 60)
colormap = AnnotateColorSaturation(agedays)
model, rows = treeview.get_selection().get_selected_rows()
model.clear()
self.stbar.begin()
self.stbar.set_status_text(hglib.toutf('hg ' + ' '.join(args[2:])))
hbox = gtk.HBox()
lbl = gtk.Label(hglib.toutf(os.path.basename(path) + '@' + str(rev)))
close = self.create_tab_close_button()
close.connect('clicked', self.close_page, frame)
hbox.pack_start(lbl, True, True, 2)
hbox.pack_start(close, False, False)
hbox.show_all()
self.notebook.set_tab_label(frame, hbox)
gobject.timeout_add(50, self.annotate_wait, thread, q, treeview,
curdate, colormap, frame, rows)
def annotate_wait(self, thread, q, tview, curdate, colormap, frame, rows):
"""
Handle all the messages currently in the queue (if any).
"""
model = tview.get_model()
while q.qsize():
line = q.get(0).rstrip('\r\n')
try:
(revpath, text) = line.split(':', 1)
revid, path = revpath.lstrip().split(' ', 1)
rowrev = long(revid)
except ValueError:
continue
tip, user = self.get_rev_desc(rowrev)
ctx = self.repo[rowrev]
color = colormap.get_color(ctx, curdate)
if self.tabwidth:
text = text.expandtabs(self.tabwidth)
model.append((revid, hglib.toutf(text[:512]), tip, hglib.toutf(path.strip()),
color, user, len(model)+1))
if thread.isAlive():
return True
else:
if threading.activeCount() == 1:
self.stop_button.set_sensitive(False)
if rows:
tview.get_selection().select_path(rows[0])
tview.scroll_to_cell(rows[0], use_align=True, row_align=0.5)
tview.grab_focus()
frame._mythread = None
self.stbar.end()
return False
def ann_selection_changed(self, treeview):
"""
User selected line of annotate output, describe revision
responsible for this line in the status bar
"""
(path, focus) = treeview.get_cursor()
model = treeview.get_model()
if path is not None and model is not None:
anniter = model.get_iter(path)
self.currev = model[anniter][self.COL_REVID]
self.path = model.path
self.stbar.set_status_text(model[anniter][self.COL_TOOLTIP])
def ann_button_release(self, widget, event, objs):
if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |
gtk.gdk.CONTROL_MASK)):
self.ann_popup_menu(widget, event.button, event.time, objs)
return False
def ann_popup_menu(self, treeview, button, time, objs):
ann_cmenu = self.annotate_context_menu(objs)
ann_cmenu.popup(None, None, None, button, time)
return True
def ann_row_act(self, tree, path, column, objs):
ann_cmenu = self.annotate_context_menu(objs)
ann_cmenu.get_children()[0].activate()
def create_menu(label, callback, *args):
menuitem = gtk.MenuItem(label, True)
menuitem.connect('activate', callback, *args)
menuitem.set_border_width(1)
return menuitem
def run(ui, *pats, **opts):
cmdoptions = {
'follow':False, 'follow-first':False, 'copies':False, 'keyword':[],
'limit':0, 'rev':[], 'removed':False, 'no_merges':False, 'date':None,
'only_merges':None, 'prune':[], 'git':False, 'verbose':False,
'include':[], 'exclude':[]
}
return DataMineDialog(ui, None, None, pats, cmdoptions)
|
@@ -15,8 +15,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import gtk
-from thgutil.i18n import _
-from hggtk import gtklib
+from tortoisehg.util.i18n import _
+from tortoisehg.hgtk import gtklib
def entry_dialog(parent, msg, visible=True, default='', respfunc=None):
""" Allow a user to enter a text string (username/password)
|
@@ -17,10 +17,10 @@
from mercurial import cmdutil, util, ui, hg, commands
-from thgutil.i18n import _
-from thgutil import settings, hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import settings, hglib, paths
-from hggtk import gtklib
+from tortoisehg.hgtk import gtklib
class SimpleMessage(gtklib.MessageDialog):
def run(self):
@@ -344,7 +344,7 @@ if not url.startswith('http'):
docpath = os.path.dirname(paths.get_license_path())
url = os.path.join(docpath, url)
- from hggtk import about
+ from tortoisehg.hgtk import about
about.browseurl(url)
def launch(self, item, app):
@@ -517,7 +517,7 @@ return True, textout
def _do_diff(self, canonpats, options):
- from hggtk import visdiff
+ from tortoisehg.hgtk import visdiff
options['canonpats'] = canonpats
dialog = visdiff.run(self.ui, **options)
if not dialog:
@@ -530,7 +530,7 @@ self._do_diff(file and [file] or [], self.opts)
def _view_files(self, files, otherparent):
- from hggtk import thgconfig
+ from tortoisehg.hgtk import thgconfig
def cleanup():
shutil.rmtree(self.tmproot)
|
@@ -11,8 +11,8 @@ import gobject
import mercurial
-from thgutil.i18n import _
-from hggtk import gtklib, gdialog
+from tortoisehg.util.i18n import _
+from tortoisehg.hgtk import gtklib, gdialog
class GotoRevDialog(gtk.Dialog):
|
@@ -12,10 +12,10 @@ import gobject
import pango
-from thgutil.i18n import _
-from thgutil import paths, hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import paths, hglib
-from hggtk import hgtk
+from tortoisehg.hgtk import hgtk
if gtk.gtk_version < (2, 14, 0):
# at least on 2.12.12, gtk widgets can be confused by control
@@ -329,7 +329,7 @@ pass
else:
def selectlang(senderitem):
- from hggtk import dialog
+ from tortoisehg.hgtk import dialog
spell = gtkspell.get_from_text_view(textview)
lang = ''
while True:
|
@@ -15,11 +15,11 @@
from mercurial import hg, ui, mdiff, cmdutil, match, util
-from thgutil.i18n import _
-from thgutil.hglib import toutf, fromutf, diffexpand, RepoError
-from thgutil import shlib, paths, thread2, settings
+from tortoisehg.util.i18n import _
+from tortoisehg.util.hglib import toutf, fromutf, diffexpand, RepoError
+from tortoisehg.util import shlib, paths, thread2, settings
-from hggtk import gtklib
+from tortoisehg.hgtk import gtklib
# This function and some key bits below borrowed ruthelessly from
# Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
|
@@ -12,10 +12,10 @@ import os
import Queue
-from thgutil.i18n import _
-from thgutil import shlib, hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import shlib, hglib
-from hggtk import gtklib, hgthread
+from tortoisehg.hgtk import gtklib, hgthread
class CmdDialog(gtk.Dialog):
def __init__(self, cmdline, progressbar=True):
|
@@ -15,10 +15,10 @@
from mercurial import hg, ui, extensions
-from thgutil.i18n import _
-from thgutil import hglib, settings
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings
-from hggtk import gtklib, dialog, thgconfig, hgcmd
+from tortoisehg.hgtk import gtklib, dialog, thgconfig, hgcmd
class EmailDialog(gtk.Window):
""" Send patches or bundles via email """
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui, match, util
-from thgutil.i18n import _
-from thgutil import shlib, hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import shlib, hglib, paths
-from hggtk import gtklib, gdialog
+from tortoisehg.hgtk import gtklib, gdialog
class HgIgnoreDialog(gtk.Window):
'Edit a reposiory .hgignore file'
|
@@ -10,10 +10,10 @@
from mercurial import hg, ui, util
-from thgutil.i18n import _
-from thgutil import hglib, shlib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, shlib
-from hggtk import dialog, gtklib
+from tortoisehg.hgtk import dialog, gtklib
class InitDialog(gtk.Dialog):
""" Dialog to initialize a Mercurial repo """
|
@@ -11,10 +11,10 @@
from mercurial import ui, util
-from thgutil.i18n import _
-from thgutil import hglib, thread2
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, thread2
-from hggtk import dialog, gdialog
+from tortoisehg.hgtk import dialog, gdialog
class GtkUi(ui.ui):
'''
|
|
|
@@ -22,9 +22,9 @@ import mercurial.ui as _ui
from mercurial import hg, util, fancyopts, cmdutil, extensions
-from thgutil.i18n import agettext as _
-from thgutil import hglib, paths, shlib
-from thgutil import version as thgversion
+from tortoisehg.util.i18n import agettext as _
+from tortoisehg.util import hglib, paths, shlib
+from tortoisehg.util import version as thgversion
nonrepo_commands = '''userconfig clone debugcomplete init about help
version thgstatus serve'''
@@ -55,7 +55,7 @@ except KeyboardInterrupt:
print _('\nCaught keyboard interrupt, aborting.\n')
except:
- from hggtk.bugreport import run
+ from tortoisehg.hgtk.bugreport import run
if '--debugger' in args:
pdb.post_mortem(sys.exc_info()[2])
error = traceback.format_exc()
@@ -275,7 +275,7 @@
def about(ui, *pats, **opts):
"""about TortoiseHg"""
- from hggtk.about import run
+ from tortoisehg.hgtk.about import run
gtkrun(run, ui, *pats, **opts)
def add(ui, *pats, **opts):
@@ -286,12 +286,12 @@
def thgstatus(ui, *pats, **opts):
"""update TortoiseHg status cache"""
- from hggtk.thgstatus import run
+ from tortoisehg.util.thgstatus import run
run(ui, *pats, **opts)
def clone(ui, *pats, **opts):
"""clone tool"""
- from hggtk.clone import run
+ from tortoisehg.hgtk.clone import run
gtkrun(run, ui, *pats, **opts)
def commit(ui, *pats, **opts):
@@ -302,89 +302,89 @@ if len(repo.parents()) > 1:
os.chdir(repo.root)
pats = []
- from hggtk.commit import run
+ from tortoisehg.hgtk.commit import run
gtkrun(run, ui, *pats, **opts)
def shelve(ui, *pats, **opts):
"""shelve/unshelve tool"""
- from hggtk.thgshelve import run
+ from tortoisehg.hgtk.thgshelve import run
gtkrun(run, ui, *pats, **opts)
def userconfig(ui, *pats, **opts):
"""user configuration editor"""
- from hggtk.thgconfig import run
+ from tortoisehg.hgtk.thgconfig import run
opts['repomode'] = False
gtkrun(run, ui, *pats, **opts)
def repoconfig(ui, *pats, **opts):
"""repository configuration editor"""
- from hggtk.thgconfig import run
+ from tortoisehg.hgtk.thgconfig import run
opts['repomode'] = True
gtkrun(run, ui, *pats, **opts)
def rename(ui, *pats, **opts):
"""rename a single file or directory"""
if not pats or len(pats) > 2:
- from hggtk import gdialog
+ from tortoisehg.hgtk import gdialog
gdialog.Prompt(_('Rename error'),
_('rename takes one or two path arguments'), None).run()
return
- from hggtk.rename import run
+ from tortoisehg.hgtk.rename import run
gtkrun(run, ui, *pats, **opts)
def guess(ui, *pats, **opts):
"""guess previous renames or copies"""
- from hggtk.guess import run
+ from tortoisehg.hgtk.guess import run
gtkrun(run, ui, *pats, **opts)
def datamine(ui, *pats, **opts):
"""repository search and annotate tool"""
- from hggtk.datamine import run
+ from tortoisehg.hgtk.datamine import run
gtkrun(run, ui, *pats, **opts)
def hgignore(ui, *pats, **opts):
"""ignore filter editor"""
- from hggtk.hgignore import run
+ from tortoisehg.hgtk.hgignore import run
gtkrun(run, ui, *pats, **opts)
def hginit(ui, *pats, **opts):
"""repository initialization tool"""
- from hggtk.hginit import run
+ from tortoisehg.hgtk.hginit import run
gtkrun(run, ui, *pats, **opts)
def log(ui, *pats, **opts):
"""changelog viewer"""
- from hggtk.history import run
+ from tortoisehg.hgtk.history import run
gtkrun(run, ui, *pats, **opts)
def merge(ui, *pats, **opts):
"""merge tool"""
- from hggtk.merge import run
+ from tortoisehg.hgtk.merge import run
gtkrun(run, ui, *pats, **opts)
def recovery(ui, *pats, **opts):
"""recover, rollback & verify"""
- from hggtk.recovery import run
+ from tortoisehg.hgtk.recovery import run
gtkrun(run, ui, *pats, **opts)
def remove(ui, *pats, **opts):
"""file status viewer in remove mode"""
- from hggtk.status import run
+ from tortoisehg.hgtk.status import run
gtkrun(run, ui, *pats, **opts)
def revert(ui, *pats, **opts):
"""file status viewer in revert mode"""
- from hggtk.status import run
+ from tortoisehg.hgtk.status import run
gtkrun(run, ui, *pats, **opts)
def forget(ui, *pats, **opts):
"""file status viewer in forget mode"""
- from hggtk.status import run
+ from tortoisehg.hgtk.status import run
gtkrun(run, ui, *pats, **opts)
def serve(ui, *pats, **opts):
"""web server"""
- from hggtk.serve import run
+ from tortoisehg.hgtk.serve import run
if paths.find_root() == None and not opts['webdir_conf']:
raise hglib.RepoError(_("There is no Mercurial repository here"
" (.hg not found)"))
@@ -392,12 +392,12 @@
def status(ui, *pats, **opts):
"""file status & diff viewer"""
- from hggtk.status import run
+ from tortoisehg.hgtk.status import run
gtkrun(run, ui, *pats, **opts)
def synch(ui, *pats, **opts):
"""repository synchronization tool"""
- from hggtk.synch import run
+ from tortoisehg.hgtk.synch import run
cmd = opts['alias']
if cmd in ('push', 'outgoing', 'email'):
opts['pushmode'] = True
@@ -407,12 +407,12 @@
def update(ui, *pats, **opts):
"""update/checkout tool"""
- from hggtk.update import run
+ from tortoisehg.hgtk.update import run
gtkrun(run, ui, *pats, **opts)
def vdiff(ui, *pats, **opts):
"""launch configured visual diff tool"""
- from hggtk.visdiff import run, rawextdiff
+ from tortoisehg.hgtk.visdiff import run, rawextdiff
if opts.get('raw'):
rawextdiff(ui, *pats, **opts)
return
@@ -614,7 +614,7 @@
def archive(ui, *pats, **opts):
"""create an unversioned archive of a repository revision"""
- from hggtk.archive import run
+ from tortoisehg.hgtk.archive import run
gtkrun(run, ui, *pats, **opts)
globalopts = [
|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/histdetails.py
Stacked
renamed from hggtk/histdetails.py
|
||
---|---|---|
@@ -8,9 +8,9 @@ import gtk
import gobject
-from thgutil.i18n import _
+from tortoisehg.util.i18n import _
-from hggtk import gtklib
+from tortoisehg.hgtk import gtklib
class LogDetailsDialog(gtk.Dialog):
|
@@ -14,14 +14,14 @@
from mercurial import ui, hg, cmdutil, commands, extensions, util
-from thgutil.i18n import _
-from thgutil import hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
-from hggtk.logview.treeview import TreeView as LogTreeView
+from tortoisehg.hgtk.logview.treeview import TreeView as LogTreeView
-from hggtk import gdialog, gtklib, hgcmd, datamine, logfilter, gorev
-from hggtk import backout, status, hgemail, tagadd, update, merge, archive
-from hggtk import changeset, thgconfig, thgmq, histdetails
+from tortoisehg.hgtk import gdialog, gtklib, hgcmd, datamine, logfilter, gorev
+from tortoisehg.hgtk import backout, status, hgemail, tagadd, update, merge
+from tortoisehg.hgtk import archive, changeset, thgconfig, thgmq, histdetails
def create_menu(label, callback):
menuitem = gtk.MenuItem(label, True)
@@ -122,7 +122,7 @@ elif not parents == newparents:
self.refresh_model()
- from hggtk import synch
+ from tortoisehg.hgtk import synch
parents = [x.node() for x in self.repo.parents()]
dlg = synch.SynchDialog([], False, True)
dlg.set_notify_func(synch_callback, parents)
|
renamed from hggtk/logview/__init__.py
|
||
---|---|---|
renamed from hggtk/logview/colormap.py
|
||
---|---|---|
renamed from hggtk/logview/graphcell.py
|
||
---|---|---|
renamed from hggtk/logview/revgraph.py
|
||
---|---|---|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/logview/treemodel.py
Stacked
renamed from hggtk/logview/treemodel.py
|
||
---|---|---|
@@ -17,8 +17,8 @@ import gtk
import gobject
from mercurial import util, templatefilters
-from thgutil import hglib
-from hggtk import gtklib
+from tortoisehg.util import hglib
+from tortoisehg.hgtk import gtklib
# treemodel row enumerated attributes
LINES = 0 # These elements come from the changelog walker
|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/logview/treeview.py
Stacked
renamed from hggtk/logview/treeview.py
|
||
---|---|---|
@@ -21,12 +21,12 @@ import re
import time
-from thgutil.i18n import _
-from thgutil import hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib
-from hggtk.logview import treemodel
-from hggtk.logview.graphcell import CellRendererGraph
-from hggtk.logview.revgraph import *
+from tortoisehg.hgtk.logview import treemodel
+from tortoisehg.hgtk.logview.graphcell import CellRendererGraph
+from tortoisehg.hgtk.logview.revgraph import *
class TreeView(gtk.ScrolledWindow):
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui
-from thgutil.i18n import _
-from thgutil import hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
-from hggtk import changesetinfo, gtklib, commit, gdialog, hgcmd
+from tortoisehg.hgtk import changesetinfo, gtklib, commit, gdialog, hgcmd
class MergeDialog(gtk.Window):
""" Dialog to merge revisions of a Mercurial repo """
|
@@ -15,10 +15,10 @@
from mercurial import hg, ui
-from thgutil.i18n import _
-from thgutil import hglib, shlib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, shlib, paths
-from hggtk import gdialog, dialog, gtklib, hgthread
+from tortoisehg.hgtk import gdialog, dialog, gtklib, hgthread
class RecoveryDialog(gtk.Window):
def __init__(self):
|
|
@@ -0,0 +1,73 @@ + # rename.py - TortoiseHg's dialogs for handling renames
+#
+# Copyright 2009 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 sys
+import gtk
+import cStringIO
+
+from mercurial import hg, ui, util, commands
+
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
+
+from tortoisehg.hgtk import dialog
+
+def run(ui, *pats, **opts):
+ fname, target = '', ''
+ try:
+ fname = pats[0]
+ target = pats[1]
+ except IndexError:
+ pass
+ fname = util.normpath(fname)
+ if target:
+ target = hglib.toutf(util.normpath(target))
+ else:
+ target = hglib.toutf(fname)
+ title = _('Rename ') + hglib.toutf(fname)
+ dlg = dialog.entry_dialog(None, title, True, target, rename_resp)
+ dlg.orig = fname
+ return dlg
+
+def rename_resp(dlg, response):
+ if response != gtk.RESPONSE_OK:
+ dlg.destroy()
+ return
+ try:
+ root = paths.find_root()
+ repo = hg.repository(ui.ui(), root)
+ except (ImportError, hglib.RepoError):
+ dlg.destroy()
+ return
+
+ new_name = hglib.fromutf(dlg.entry.get_text())
+ opts = {}
+ opts['force'] = False # Checkbox? Nah.
+ opts['after'] = False
+ opts['dry_run'] = False
+
+ saved = sys.stderr
+ errors = cStringIO.StringIO()
+ toquit = False
+ try:
+ sys.stderr = errors
+ repo.ui.pushbuffer()
+ repo.ui.quiet = True
+ try:
+ commands.rename(repo.ui, repo, dlg.orig, new_name, **opts)
+ toquit = True
+ except (util.Abort, hglib.RepoError), inst:
+ dlg.error_dialog(None, _('rename error'), str(inst))
+ toquit = False
+ finally:
+ sys.stderr = saved
+ textout = errors.getvalue() + repo.ui.popbuffer()
+ errors.close()
+ if len(textout) > 1:
+ dlg.error_dialog(None, _('rename error'), textout)
+ elif toquit:
+ dlg.destroy()
|
@@ -20,10 +20,10 @@ from mercurial import hg, ui, commands, cmdutil, util
from mercurial.hgweb import server
-from thgutil.i18n import _
-from thgutil import hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
-from hggtk import dialog, gdialog, gtklib, thgconfig
+from tortoisehg.hgtk import dialog, gdialog, gtklib, thgconfig
gservice = None
class ServeDialog(gtk.Window):
|
@@ -18,10 +18,10 @@ from mercurial import cmdutil, util, commands, patch, mdiff
from mercurial import merge as merge_
-from thgutil.i18n import _
-from thgutil import hglib, shlib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, shlib, paths, hgshelve
-from hggtk import dialog, gdialog, hgshelve, gtklib, guess, hgignore
+from tortoisehg.hgtk import dialog, gdialog, gtklib, guess, hgignore
# file model row enumerations
FM_CHECKED = 0
@@ -1334,7 +1334,7 @@ def remove(menuitem, files):
self.hg_remove(files)
def log(menuitem, files):
- from hggtk import history
+ from tortoisehg.hgtk import history
dlg = history.run(self.ui, canonpats=files)
dlg.display()
def forget(menuitem, files):
|
@@ -17,11 +17,11 @@
from mercurial import hg, ui, extensions, url
-from thgutil.i18n import _
-from thgutil import hglib, settings, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings, paths
-from hggtk import dialog, gtklib, hgthread, history, thgconfig, hgemail
-from hggtk import thgshelve
+from tortoisehg.hgtk import dialog, gtklib, hgthread, history, thgconfig
+from tortoisehg.hgtk import thgshelve, hgemail
class SynchDialog(gtk.Window):
def __init__(self, repos=[], pushmode=False, fromlog=False):
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui, util
-from thgutil.i18n import _
-from thgutil import hglib, settings, i18n
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings, i18n
-from hggtk import dialog, gtklib
+from tortoisehg.hgtk import dialog, gtklib
keep = i18n.keepgettext()
|
Change 1 of 2
Show Entire File
tortoisehg/hgtk/taskbarui.py
Stacked
renamed from hggtk/taskbarui.py
|
||
---|---|---|
@@ -9,9 +9,9 @@ import gtk
import gobject
-from thgutil.i18n import _
-from thgutil import hglib, settings, menuthg
-from hggtk import gtklib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings, menuthg
+from tortoisehg.hgtk import gtklib
shellcmds = '''about add clone commit datamine init log recovery
shelve synch status thgstatus userconf repoconf remove rename
@@ -207,7 +207,7 @@ return frame
def about(self, button):
- from hggtk import about
+ from tortoisehg.hgtk import about
dlg = about.AboutDialog()
dlg.show_all()
|
Change 1 of 2
Show Entire File
tortoisehg/hgtk/thgconfig.py
Stacked
renamed from hggtk/thgconfig.py
|
||
---|---|---|
@@ -14,10 +14,10 @@
from mercurial import hg, ui, util, url, filemerge
-from thgutil.i18n import _
-from thgutil import hglib, settings, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings, paths
-from hggtk import dialog, gdialog, gtklib, hgcmd
+from tortoisehg.hgtk import dialog, gdialog, gtklib, hgcmd
_unspecstr = _('<unspecified>')
_unspeclocalstr = hglib.fromutf(_unspecstr)
@@ -734,7 +734,7 @@ self.pathdata.get_path(i),
self.pathtree.get_column(0))
self.refresh_path_list()
- # This method may be called from hggtk.sync, so ensure page is visible
+ # This method may be called from hgtk.sync, so ensure page is visible
self.notebook.set_current_page(3)
self.dirty_event()
|
@@ -10,10 +10,10 @@ import gobject
import pango
-from thgutil.i18n import _
-from thgutil import hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib
-from hggtk import gtklib, hgcmd
+from tortoisehg.hgtk import gtklib, hgcmd
# MQ patches row enumerations
MQ_INDEX = 0
|
Change 1 of 1
Show Entire File
tortoisehg/hgtk/thgshelve.py
Stacked
renamed from hggtk/thgshelve.py
|
||
---|---|---|
@@ -12,11 +12,11 @@
from mercurial import util
-from thgutil.i18n import _
-from thgutil import hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, hgshelve
-from hggtk.status import GStatus, FM_STATUS, FM_CHECKED
-from hggtk import hgshelve, gdialog, gtklib
+from tortoisehg.hgtk.status import GStatus, FM_STATUS, FM_CHECKED
+from tortoisehg.hgtk import gdialog, gtklib
class GShelve(GStatus):
"""GTK+ based dialog for displaying repository status and shelving changes.
|
@@ -12,10 +12,10 @@
from mercurial import hg, ui
-from thgutil.i18n import _
-from thgutil import hglib, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, paths
-from hggtk import hgcmd, gtklib
+from tortoisehg.hgtk import hgcmd, gtklib
_branch_tip_ = _('= Current Branch Tip =')
|
@@ -15,10 +15,10 @@
from mercurial import hg, ui, cmdutil, util
-from thgutil.i18n import _
-from thgutil import hglib, settings, paths
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib, settings, paths
-from hggtk import gdialog, gtklib
+from tortoisehg.hgtk import gdialog, gtklib
try:
import win32con
|
@@ -22,7 +22,7 @@ _encodingmode = encoding.encodingmode
_fallbackencoding = encoding.fallbackencoding
-from thgutil.hgversion import hgversion
+from tortoisehg.util.hgversion import hgversion
def tounicode(s):
"""
|
@@ -21,8 +21,8 @@ from mercurial import cmdutil, commands, cmdutil, hg, mdiff, patch, revlog
from mercurial import util, fancyopts
-from thgutil.i18n import _
-from thgutil import hglib
+from tortoisehg.util.i18n import _
+from tortoisehg.util import hglib
lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
|
@@ -7,7 +7,7 @@
import gettext, sys
from gettext import gettext as _
-from thgutil import paths, hglib
+from tortoisehg.util import paths, hglib
gettext.bindtextdomain("tortoisehg", paths.get_locale_path())
gettext.textdomain("tortoisehg")
|
@@ -66,7 +66,7 @@ return _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE,
r"Software\TortoiseHg")
except:
- return os.path.dirname(os.path.dirname(__file__))
+ return os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
def netdrive_status(drive):
"""
@@ -99,7 +99,7 @@ return None
def get_prog_root():
- path = os.path.dirname(os.path.dirname(__file__))
+ path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
return path
def netdrive_status(drive):
|
Change 1 of 1
Show Entire File
tortoisehg/util/thgstatus.py
Stacked
renamed from hggtk/thgstatus.py
|
||
---|---|---|
@@ -8,7 +8,7 @@ '''update TortoiseHg status cache'''
from mercurial import hg
-from thgutil import paths, shlib
+from tortoisehg.util import paths, shlib
import os
def cachefilepath(repo):
|
@@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
-from thgutil.i18n import _
+from tortoisehg.util.i18n import _
def version():
try:
|
@@ -18,12 +18,12 @@ pfile = pfile[:-1]
path = os.path.dirname(os.path.dirname(os.path.realpath(pfile)))
thgpath = os.path.normpath(path)
- testpath = os.path.join(thgpath, 'thgutil')
+ testpath = os.path.join(thgpath, 'tortoisehg')
if os.path.isdir(testpath) and thgpath not in sys.path:
sys.path.insert(0, thgpath)
_thg_path()
-from thgutil.menuthg import thgcmenu
+from tortoisehg.util.menuthg import thgcmenu
regkeytmpl = u'[HKEY_CURRENT_USER\\Software\\TortoiseHg\\CMenu\\%s\\%s]'
regheaders = ( u'Windows Registry Editor Version 5.00',
|
Loading...