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
|
@@ -15,14 +15,13 @@
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
@@ -161,7 +160,7 @@ 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()
|
@@ -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 Changes Only
tortoisehg/hgtk/logview/treeview.py
Stacked
renamed from hggtk/logview/treeview.py
|
||
---|---|---|
|
|
# treeview.py - changelog viewer implementation
#
# 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.
''' Mercurial revision DAG visualization library
Implements a gtk.TreeModel which visualizes a Mercurial repository
revision history.
Portions of this code stolen mercilessly from bzr-gtk visualization
dialog. Other portions stolen from graphlog extension.
'''
import gtk
import gobject
import pango
import os
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):
__gproperties__ = {
'repo': (gobject.TYPE_PYOBJECT,
'Repository',
'The Mercurial repository being visualized',
gobject.PARAM_CONSTRUCT_ONLY | gobject.PARAM_WRITABLE),
'limit': (gobject.TYPE_PYOBJECT,
'Revision Display Limit',
'The maximum number of revisions to display',
gobject.PARAM_READWRITE),
'original-tip-revision': (gobject.TYPE_PYOBJECT,
'Tip revision when application opened',
'Revisions above this number will be drawn green',
gobject.PARAM_READWRITE),
'date-column-visible': (gobject.TYPE_BOOLEAN,
'Date',
'Show date column',
False,
gobject.PARAM_READWRITE),
'utc-column-visible': (gobject.TYPE_BOOLEAN,
'UTC',
'Show UTC/GMT date column',
False,
gobject.PARAM_READWRITE),
'age-column-visible': (gobject.TYPE_BOOLEAN,
'Age',
'Show age column',
False,
gobject.PARAM_READWRITE),
'rev-column-visible': (gobject.TYPE_BOOLEAN,
'Rev',
'Show revision number column',
False,
gobject.PARAM_READWRITE),
'id-column-visible': (gobject.TYPE_BOOLEAN,
'Tags',
'Show revision ID column',
False,
gobject.PARAM_READWRITE),
'branch-column-visible': (gobject.TYPE_BOOLEAN,
'Branch',
'Show branch',
False,
gobject.PARAM_READWRITE),
'tag-column-visible': (gobject.TYPE_BOOLEAN,
'Tags',
'Show tag column',
False,
gobject.PARAM_READWRITE),
'branch-color': (gobject.TYPE_BOOLEAN,
'Branch color',
'Color by branch',
False,
gobject.PARAM_READWRITE)
}
__gsignals__ = {
'revisions-loaded': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
()),
'batch-loaded': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
()),
'revision-selected': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
())
}
def __init__(self, repo, limit=500, pbar=None):
"""Create a new TreeView.
:param repo: Repository object to show
"""
gtk.ScrolledWindow.__init__(self)
self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.set_shadow_type(gtk.SHADOW_IN)
self.batchsize = limit
self.repo = repo
self.currevid = None
self.construct_treeview()
self.pbar = pbar
self.origtip = None
self.branch_color = False
def set_repo(self, repo, pbar=None):
self.repo = repo
self.pbar = pbar
self.set_author_color()
def search_in_tree(self, model, column, key, iter, data):
"""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()
row = model[iter]
if row[treemodel.HEXID].startswith(key):
return False
for col in (treemodel.REVID, treemodel.COMMITER, treemodel.MESSAGE):
if key in str(row[col]).lower():
return False
return True
def create_log_generator(self, graphcol, pats, opts):
if self.repo is None:
self.grapher = None
return
if opts.get('filehist') is not None:
self.grapher = filelog_grapher(self.repo, opts['filehist'])
elif graphcol:
end = 0
if pats is not None: # branch name
b = self.repo.branchtags()
if pats in b:
node = b[pats]
start = self.repo.changelog.rev(node)
else:
start = len(self.repo.changelog) - 1
elif opts.get('revrange'):
if len(opts['revrange']) >= 2:
start, end = opts['revrange']
else:
start = opts['revrange'][0]
end = start
else:
start = len(self.repo.changelog) - 1
noheads = opts.get('noheads', False)
if opts.get('branch-view', False):
self.grapher = branch_grapher(self.repo, start, end)
else:
self.grapher = revision_grapher(self.repo, start, end, pats,
noheads, self.branch_color)
elif opts.get('revlist', None):
self.grapher = dumb_log_generator(self.repo, opts['revlist'])
else:
self.grapher = filtered_log_generator(self.repo, pats, opts)
self.show_graph = graphcol
self.graphdata = []
self.index = {}
self.max_cols = 1
self.model = None
self.limit = self.batchsize
def populate(self, revid=None):
'Fill the treeview with contents'
stopped = False
if self.repo is None:
stopped = True
return False
if os.name == "nt":
timer = time.clock
else:
timer = time.time
startsec = timer()
try:
while (not self.limit) or len(self.graphdata) < self.limit:
(rev, node, lines, parents) = self.grapher.next()
self.max_cols = max(self.max_cols, len(lines))
self.index[rev] = len(self.graphdata)
self.graphdata.append( (rev, node, lines, parents) )
if self.model:
rowref = self.model.get_iter(len(self.graphdata)-1)
path = self.model.get_path(rowref)
self.model.row_inserted(path, rowref)
cursec = timer()
if cursec < startsec or cursec > startsec + 0.1:
break
except StopIteration:
stopped = True
if stopped:
pass
elif self.limit is None:
return True
elif len(self.graphdata) < self.limit:
return True
if not len(self.graphdata):
self.treeview.set_model(None)
if self.pbar is not None:
self.pbar.end()
self.emit('revisions-loaded')
return False
self.graph_cell.columns_len = self.max_cols
width = self.graph_cell.get_size(self.treeview)[2]
if width > 500:
width = 500
self.graph_column.set_fixed_width(width)
# Allow the user to set size as they like
#self.graph_column.set_max_width(500)
self.graph_column.set_visible(self.show_graph)
if not self.model:
self.model = treemodel.TreeModel(self.repo, self.graphdata,
self.color_func)
self.treeview.set_model(self.model)
self.emit('batch-loaded')
if stopped:
self.emit('revisions-loaded')
if revid is not None:
self.set_revision_id(revid)
if self.pbar is not None:
self.pbar.end()
return False
def do_get_property(self, property):
if property.name == 'date-column-visible':
return self.date_column.get_visible()
elif property.name == 'id-column-visible':
return self.id_column.get_visible()
elif property.name == 'rev-column-visible':
return self.rev_column.get_visible()
elif property.name == 'branch-column-visible':
return self.branch_column.get_visible()
elif property.name == 'branch-color':
return self.branch_color
elif property.name == 'utc-column-visible':
return self.utc_column.get_visible()
elif property.name == 'age-column-visible':
return self.age_column.get_visible()
elif property.name == 'tag-column-visible':
return self.tag_column.get_visible()
elif property.name == 'repo':
return self.repo
elif property.name == 'limit':
return self.limit
else:
raise AttributeError, 'unknown property %s' % property.name
def do_set_property(self, property, value):
if property.name == 'date-column-visible':
self.date_column.set_visible(value)
elif property.name == 'id-column-visible':
self.id_column.set_visible(value)
elif property.name == 'rev-column-visible':
self.rev_column.set_visible(value)
elif property.name == 'branch-column-visible':
self.branch_column.set_visible(value)
elif property.name == 'branch-color':
self.branch_color = value
elif property.name == 'utc-column-visible':
self.utc_column.set_visible(value)
elif property.name == 'age-column-visible':
self.age_column.set_visible(value)
elif property.name == 'tag-column-visible':
self.tag_column.set_visible(value)
elif property.name == 'repo':
self.repo = value
elif property.name == 'limit':
self.batchsize = value
else:
raise AttributeError, 'unknown property %s' % property.name
def get_revid_at_path(self, path):
return self.model[path][treemodel.REVID]
def next_revision_batch(self, size):
self.batchsize = size
self.limit += self.batchsize
if self.pbar is not None:
self.pbar.begin()
gobject.idle_add(self.populate)
def load_all_revisions(self):
self.limit = None
if self.pbar is not None:
self.pbar.begin()
gobject.idle_add(self.populate)
def scroll_to_revision(self, revid):
if revid in self.index:
row = self.index[revid]
self.treeview.scroll_to_cell(row, use_align=True, row_align=0.5)
def set_revision_id(self, revid, load=False):
"""Change the currently selected revision.
:param revid: Revision id of revision to display.
"""
if revid in self.index:
row = self.index[revid]
self.treeview.set_cursor(row)
self.treeview.grab_focus()
elif load:
handler = None
def loaded(dummy):
if revid in self.index:
if handler is not None:
self.disconnect(handler)
self.set_revision_id(revid)
self.scroll_to_revision(revid)
else:
self.next_revision_batch(self.batchsize)
handler = self.connect('batch-loaded', loaded)
self.next_revision_batch(self.batchsize)
def refresh(self, graphcol, pats, opts):
self.origtip = opts['orig-tip']
if self.repo is not None:
hglib.invalidaterepo(self.repo)
if len(self.repo.changelog) > 0:
self.create_log_generator(graphcol, pats, opts)
if self.pbar is not None:
self.pbar.begin()
gobject.idle_add(self.populate, self.currevid)
else:
self.treeview.set_model(None)
self.pbar.set_status_text('Repository is empty')
def set_author_color(self):
# If user has configured authorcolor in [tortoisehg], color
# rows by author matches
self.author_pats = []
self.color_func = self.text_color_orig
if self.repo is not None:
for k, v in self.repo.ui.configitems('tortoisehg'):
if not k.startswith('authorcolor.'): continue
pat = k[12:]
self.author_pats.append((re.compile(pat, re.I), v))
if self.author_pats or self.repo.ui.configbool('tortoisehg',
'authorcolor'):
self.color_func = self.text_color_author
else:
self.color_func = self.text_color_orig
def construct_treeview(self):
self.treeview = gtk.TreeView()
self.treeview.set_rules_hint(True)
self.treeview.set_reorderable(False)
self.treeview.set_enable_search(True)
self.treeview.set_search_equal_func(self.search_in_tree, None)
self.set_author_color()
self.treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)
self.treeview.connect("cursor-changed", self._on_selection_changed)
self.treeview.set_property('fixed-height-mode', True)
self.treeview.show()
self.add(self.treeview)
self.graph_cell = CellRendererGraph()
self.graph_column = gtk.TreeViewColumn(_('Graph'))
self.graph_column.set_resizable(True)
self.graph_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.graph_column.pack_start(self.graph_cell, expand=False)
self.graph_column.add_attribute(self.graph_cell,
"node", treemodel.GRAPHNODE)
self.graph_column.add_attribute(self.graph_cell,
"in-lines", treemodel.LAST_LINES)
self.graph_column.add_attribute(self.graph_cell,
"out-lines", treemodel.LINES)
self.treeview.append_column(self.graph_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 8)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.rev_column = gtk.TreeViewColumn(_('Rev'))
self.rev_column.set_visible(False)
self.rev_column.set_resizable(True)
self.rev_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.rev_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.rev_column.pack_start(cell, expand=True)
self.rev_column.add_attribute(cell, "text", treemodel.REVID)
self.rev_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.rev_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 15)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.id_column = gtk.TreeViewColumn(_('ID'))
self.id_column.set_visible(False)
self.id_column.set_resizable(True)
self.id_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.id_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.id_column.pack_start(cell, expand=True)
self.id_column.add_attribute(cell, "text", treemodel.HEXID)
self.id_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.id_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 15)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.branch_column = gtk.TreeViewColumn(_('Branch'))
self.branch_column.set_visible(False)
self.branch_column.set_resizable(True)
self.branch_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.branch_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.branch_column.pack_start(cell, expand=True)
self.branch_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.branch_column.add_attribute(cell, "markup", treemodel.BRANCH)
self.treeview.append_column(self.branch_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 65)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.msg_column = gtk.TreeViewColumn(_('Summary'))
self.msg_column.set_resizable(True)
self.msg_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.msg_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.msg_column.pack_end(cell, expand=True)
self.msg_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.msg_column.add_attribute(cell, "markup", treemodel.MESSAGE)
self.treeview.append_column(self.msg_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 20)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.committer_column = gtk.TreeViewColumn(_('User'))
self.committer_column.set_resizable(True)
self.committer_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.committer_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.committer_column.pack_start(cell, expand=True)
self.committer_column.add_attribute(cell, "text", treemodel.COMMITER)
self.committer_column.add_attribute(cell, "foreground",
treemodel.FGCOLOR)
self.treeview.append_column(self.committer_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 20)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.date_column = gtk.TreeViewColumn(_('Local Date'))
self.date_column.set_visible(False)
self.date_column.set_resizable(True)
self.date_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.date_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.date_column.pack_start(cell, expand=True)
self.date_column.add_attribute(cell, "text", treemodel.LOCALTIME)
self.date_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.date_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 20)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.utc_column = gtk.TreeViewColumn(_('Universal Date'))
self.utc_column.set_visible(False)
self.utc_column.set_resizable(True)
self.utc_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.utc_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.utc_column.pack_start(cell, expand=True)
self.utc_column.add_attribute(cell, "text", treemodel.UTC)
self.utc_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.utc_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 10)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.age_column = gtk.TreeViewColumn(_('Age'))
self.age_column.set_visible(False)
self.age_column.set_resizable(True)
self.age_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.age_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.age_column.pack_start(cell, expand=True)
self.age_column.add_attribute(cell, "text", treemodel.AGE)
self.age_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.age_column)
cell = gtk.CellRendererText()
cell.set_property("width-chars", 10)
cell.set_property("ellipsize", pango.ELLIPSIZE_END)
self.tag_column = gtk.TreeViewColumn(_('Tags'))
self.tag_column.set_visible(False)
self.tag_column.set_resizable(True)
self.tag_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
self.tag_column.set_fixed_width(cell.get_size(self.treeview)[2])
self.tag_column.pack_start(cell, expand=True)
self.tag_column.add_attribute(cell, "text", treemodel.TAGS)
self.tag_column.add_attribute(cell, "foreground", treemodel.FGCOLOR)
self.treeview.append_column(self.tag_column)
def text_color_orig(self, parents, rev, author):
if int(rev) >= self.origtip:
return 'darkgreen'
if len(parents) == 2:
# mark merge changesets blue
return 'blue'
elif len(parents) == 1:
# detect non-trivial parent
if long(rev) != parents[0]+1:
return '#900000'
else:
return 'black'
else:
return 'black'
colors = '''black blue deeppink mediumorchid blue burlywood4 goldenrod
slateblue red2 navy dimgrey'''.split()
color_cache = {}
def text_color_author(self, parents, rev, author):
if int(rev) >= self.origtip:
return 'darkgreen'
for re, v in self.author_pats:
if (re.search(author)):
return v
if author not in self.color_cache:
color = self.colors[len(self.color_cache.keys()) % len(self.colors)]
self.color_cache[author] = color
return self.color_cache[author]
def _on_selection_changed(self, treeview):
"""callback for when the treeview changes."""
(path, focus) = treeview.get_cursor()
if path:
self.currevid = self.model[path][treemodel.REVID]
self.emit('revision-selected')
|
@@ -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...