--- hgview-1.7.1.orig/MANIFEST.in +++ hgview-1.7.1/MANIFEST.in @@ -0,0 +1,34 @@ +exclude .hgignore +recursive-exclude debian * +recursive-exclude test * +recursive-exclude debian.hardy * +recursive-exclude debian.lenny * +recursive-exclude debian.intrepid * + +include ChangeLog +include COPYING +include README + +include bin/hgview +include bin/hgview.bat + +include hgviewlib/qt4/*.ui +include hgviewlib/qt4/*.py +include hgviewlib/qt4/hgqv.qrc +include hgviewlib/qt4/icons/* + +include hgviewlib/curses/*.py + +include doc/hgview.1.txt +include doc/Makefile +include hgext/hgview.py + +include hgext/hgview.rc +include doc/hgqv.1 +include setup.py +include __pkginfo__.py +include test/data/hgviewrc +include test/data/.hgviewrc + + +recursive-include etc * --- hgview-1.7.1.orig/hgviewlib/curses/tests/tests_utils.py +++ hgview-1.7.1/hgviewlib/curses/tests/tests_utils.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE). +# http://www.logilab.fr/ -- mailto:contact@logilab.fr +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +from doctest import testmod +from unittest import main, TestCase + +import logging + +import urwid + +from hgviewlib.curses import utils, exceptions + +class TestCommandsRegister(TestCase): + + def tearDown(self): + utils.unregister_command('foo') + + def test_unregister_not_registered(self): + res = utils.unregister_command('babar') + self.assertEqual(None, res) + + def test_register_multiple_times(self): + utils.register_command('foo', 'A command') + self.assertRaises(exceptions.RegisterCommandError, + utils.register_command, 'foo', 'Another command') + + def test_register_minimal(self): + utils.register_command('foo', 'A command') + res = utils.unregister_command('foo') + self.assertEqual(('A command', (), []), res) + utils.register_command('foo', 'Another command') # no exception + res = utils.unregister_command('foo') + self.assertEqual(('Another command', (), []), res) + + def test_register_bad_args(self): + self.assertRaises(exceptions.RegisterCommandError, + utils.register_command, 'foo', '', 1) + + def test_register_complete(self): + args = (utils.CommandArg('arg1', int, 'argument1'), + utils.CommandArg('arg2', float, 'argument2'),) + utils.register_command('foo', 'A command', *args) + res = utils.unregister_command('foo') + self.assertEqual(('A command', args, []), res) + + def test_help_minimal(self): + utils.register_command('foo', 'A command') + ref = ['usage: foo', + 'A command ', + ' '] + res = urwid.Text(utils.help_command('foo')).render((10,)).text + self.assertEqual(ref, res) + + def test_help_complete(self): + args = (utils.CommandArg('arg1', int, 'argument1'), + utils.CommandArg('arg2', float, 'argument2'),) + utils.register_command('foo', 'A command', *args) + res = urwid.Text(utils.help_command('foo')).render((20,)).text + ref = ['usage: foo arg1 arg2', + 'A command ', + ':arg1: argument1 ', + ':arg2: argument2 ', + ' ', + ] + self.assertEqual(ref, res) + + def test_disconnect_not_registered(self): + callback = lambda: True + self.assertRaises(exceptions.RegisterCommandError, + utils.disconnect_command, 'foo', callback) + + def test_disconnect_not_connected(self): + utils.register_command('foo', 'A command') + callback = lambda: True + self.assertRaises(exceptions.RegisterCommandError, + utils.disconnect_command, 'foo', callback) + + def connect_not_registered(self): + self.assertRaises(exceptions.RegisterCommandError, + utils.connect_command, 'foo', callback) + + def test_connects_noargs(self): + utils.register_command('foo', 'A command') + func1 = lambda: True + func2 = lambda: True + utils.connect_command('foo', func1) + utils.connect_command('foo', func2) + ref = ('A command', (), [(func1, (), {}), + (func2, (), {})]) + res = utils.unregister_command('foo') + self.assertEqual(ref, res) + + def test_connect_complete(self): + utils.register_command('foo', 'A command') + func1 = lambda: True + func2 = lambda a, b, c, d: True + utils.connect_command('foo', func1) + utils.connect_command('foo', func2, args=(1,2), kwargs={'c':3, 'd':4}) + ref = ('A command', (), + [(func1, (), {}), + (func2, (1, 2), {'c':3, 'd':4})]) + res = utils.unregister_command('foo') + self.assertEqual(ref, res) + + def test_disconnect(self): + utils.register_command('foo', 'A command') + func1 = lambda: True + func2 = lambda a, b, c, d: True + utils.connect_command('foo', func1) + utils.connect_command('foo', func2, args=(1,2), kwargs={'c':3, 'd':4}) + utils.disconnect_command('foo', func2, args=(1,2), kwargs={'c':3, 'd':4}) + ref = ('A command', (), [(func1, (), {})]) + res = utils.unregister_command('foo') + self.assertEqual(ref, res) + + def test_emit_not_registered(self): + self.assertRaises(exceptions.UnknownCommand, + utils.emit_command, 'foo') + + def test_emit_not_connected(self): + utils.register_command('foo', 'A command') + self.assertEqual(False, utils.emit_command('foo')) + + def test_emit_minimal(self): + utils.register_command('foo', 'A command') + + func3 = lambda a, b, c, d: a==1 and b==2 and c==3 and d==5 + utils.connect_command('foo', func3, args=(1,2), kwargs={'c':3, 'd':4}) + self.assertEqual(False, utils.emit_command('foo')) + + func1 = lambda: True + utils.connect_command('foo', func1) + self.assertEqual(True, utils.emit_command('foo')) + utils.disconnect_command('foo', func1) + + func2 = lambda a, b, c, d: a==1 and b==2 and c==3 and d==4 + utils.connect_command('foo', func2, args=(1,2), kwargs={'c':3, 'd':4}) + self.assertEqual(True, utils.emit_command('foo')) + + def test_emit_with_args(self): + utils.register_command('foo', 'A command') + + func3 = lambda a, b, c, d: a==1 and b==2 and c==3 and d==5 + utils.connect_command('foo', func3, args=(1,), kwargs={'c':3}) + self.assertEqual(False, utils.emit_command('foo', args=(2,), kwargs={'d':4})) + + func1 = lambda a, d: a==2 and d==4 + utils.connect_command('foo', func1) + self.assertEqual(True, utils.emit_command('foo', args=(2,), kwargs={'d':4})) + utils.disconnect_command('foo', func1) + + func2 = lambda a, b, c, d: a==1 and b==2 and c==3 and d==4 + utils.connect_command('foo', func3, args=(1,), kwargs={'c':3}) + self.assertEqual(False, utils.emit_command('foo', args=(2,), kwargs={'d':4})) + + def test_emit_convert_cmdargs(self): + cmd = 'foo 1 2 2+1 4.' + args = (utils.CommandArg('a', int, 'argument1'), + utils.CommandArg('b', str, 'argument2'), + utils.CommandArg('c', eval, 'argument2'), + utils.CommandArg('d', float, 'argument2'), ) + utils.register_command('foo', 'A command', *args) + + func = lambda a, b, c, d: a==1 and b=="2" and c==3 and d==4. + utils.connect_command('foo', func) + self.assertEqual(True, utils.emit_command(cmd)) + + def test_emit_convert_mixed(self): + cmd = 'foo "2 + 1" 4.' + args = (utils.CommandArg('c', eval, 'argument2'), + utils.CommandArg('d', float, 'argument2'), ) + utils.register_command('foo', 'A command', *args) + + func3 = lambda a, b, c, d, e, f: (a,b,c,d,e,f) == (1, "2", 3, 4., 5, 6) + utils.connect_command('foo', func3, args=(1,), kwargs={'e':5}) + self.assertEqual(True, utils.emit_command(cmd, ("2",), {'f':6})) + +if __name__ == '__main__': + testmod(utils) + main() --- hgview-1.7.1.orig/hgviewlib/curses/tests/tests_application_patches.py +++ hgview-1.7.1/hgviewlib/curses/tests/tests_application_patches.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE). +# http://www.logilab.fr/ -- mailto:contact@logilab.fr +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program. If not, see . + +from doctest import testmod +from unittest import main, TestCase + +import logging + +import urwid + +from hgviewlib.curses.application import * + +class TestConnectLogging(TestCase): + def setUp(self): + from urwid import Text, Filler, Text, raw_display, MainLoop + from hgviewlib.curses.application import connect_logging + from hgviewlib.curses import MainFrame, Body + import logging + PALETTE = [('default','default','default'), + ('edit', 'white', 'default'), + ('banner','black','light gray'), + ('DEBUG', 'yellow', 'default'), + ('INFO', 'dark gray', 'default'), + ('WARNING', 'brown', 'default'), + ('ERROR', 'light red', 'default'), + ('CRITICAL', 'white', 'dark red'), + ] + self.mainframe = MainFrame('', Body(Filler(Text('Hello world')))) + screen = raw_display.Screen() + mainloop = MainLoop(self.mainframe, PALETTE, screen) + connect_logging(mainloop, logging.DEBUG) + + def test_simple_info(self): + logging.info('noo') + res = self.mainframe.render((15, 2), False).text + self.assertEqual('noo', self.mainframe.footer.get_text()[0]) + self.assertEqual('INFO', self.mainframe.footer.attr) + + def test_display_traceback(self): + try: + 1/0 + except: + logging.debug('hello world', exc_info=True) + res = self.mainframe.footer.get_text()[0].splitlines() + ref = ['hello world', 'Traceback (most recent call last):'] + self.assertEqual(ref, res[:2]) + +if __name__ == '__main__': + main() + --- hgview-1.7.1.orig/debian/README.Debian +++ hgview-1.7.1/debian/README.Debian @@ -0,0 +1,8 @@ +To enable hgview as a mercurial extension (launchable with hg qv), +include the following lines in your hgrc: + +[extensions] +hgview= + + + -- Alexandre Fayolle , Wed, 30 Sep 2009 12:53:24 +0200 --- hgview-1.7.1.orig/debian/watch +++ hgview-1.7.1/debian/watch @@ -0,0 +1,2 @@ +version=3 +opts=pasv ftp://ftp.logilab.org/pub/hgview/hgview-(.*)\.tar\.gz --- hgview-1.7.1.orig/debian/copyright +++ hgview-1.7.1/debian/copyright @@ -0,0 +1,28 @@ +This package was debianized by Logilab Sat, 13 Apr 2002 19:05:23 +0200. + +It was downloaded from ftp://ftp.logilab.org/pub/hgview + +Upstream Author: + + Logilab + +Copyright: + +Copyright (c) 2004-2012 LOGILAB S.A. (Paris, FRANCE). +http://www.logilab.fr/ -- mailto:contact@logilab.fr + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +On Debian systems, the complete text of the GNU General Public License +may be found in '/usr/share/common-licenses/GPL'. --- hgview-1.7.1.orig/debian/control +++ hgview-1.7.1/debian/control @@ -0,0 +1,66 @@ +Source: hgview +Section: vcs +Priority: optional +Maintainer: David Douard +Uploaders: Julien Cristau , Alain Leufroy , Pierre-Yves David +Build-Depends: debhelper (>= 5.0.38), pyqt4-dev-tools, python (>=2.6.6-3~), xmlto, asciidoc, mercurial +X-Python-Version: >= 2.5 +Standards-Version: 3.9.1 +Vcs-Hg: http://www.logilab.org/cgi-bin/hgwebdir.cgi/hgview +Vcs-Browser: http://www.logilab.org/cgi-bin/hgwebdir.cgi/hgview +Homepage: http://www.logilab.org/project/hgview + +Package: hgview +Architecture: all +Depends: + ${python:Depends}, + ${misc:Depends}, + python-qt4, + python-qscintilla2, + python-docutils, + hgview-common (= ${source:Version}) +Enhances: mercurial +Description: mercurial interactive history viewer (Qt4 interface) + Its purpose is to easily navigate in a mercurial repository + history. It has been written with efficiency in mind when dealing + with quite big repositories. + . + This package installs the Qt4 interface. + +Package: hgview-common +Architecture: all +Depends: + ${python:Depends}, + ${misc:Depends}, + mercurial (>= 1.9.1-1), +Enhances: mercurial +Breaks: hgview (<< 1.4) +Replaces: hgview (<< 1.4) +Recommends: hgview | hgview-curses +Description: mercurial interactive history viewer (common files) + Its purpose is to easily navigate in a mercurial repository + history. It has been written with efficiency in mind when dealing + with quite big repositories. + . + This package install the common files. + You may want to install a user interface (hgview or hgview-curses). + +Package: hgview-curses +Architecture: all +Depends: + ${python:Depends}, + ${misc:Depends}, + python-urwid, + python-pygments, + python-pyinotify, + hgview-common (= ${source:Version}), +Enhances: mercurial +Description: mercurial interactive history viewer (text interface) + Its purpose is to easily navigate in a mercurial repository + history. It has been written with efficiency in mind when dealing + with quite big repositories. + . + This package installs the text interface. + Note that the Qt interface is more complete than the text interface and + provides more views. + --- hgview-1.7.1.orig/debian/hgview-common.install +++ hgview-1.7.1/debian/hgview-common.install @@ -0,0 +1,5 @@ +usr/lib/python*/*-packages/hgext +usr/lib/python*/*-packages/hgviewlib/*.py +usr/lib/python*/*-packages/hgviewlib/hgpatches +usr/bin +usr/man /usr/share --- hgview-1.7.1.orig/debian/changelog +++ hgview-1.7.1/debian/changelog @@ -0,0 +1,208 @@ +hgview (1.7.1-2) unstable; urgency=low + + * Upload to unstable. + + -- Julien Cristau Fri, 21 Jun 2013 13:41:07 +0200 + +hgview (1.7.1-1) experimental; urgency=low + + * New Upstream Release. + - compatible with mercurial 2.5 + - removed sys.path manipulation (closes: #630692) + + -- Pierre-Yves David Mon, 28 Jan 2013 17:34:33 +0100 + +hgview (1.7.0-1) unstable; urgency=low + + * New Upstream Release. + + -- Pierre-Yves David Tue, 13 Nov 2012 13:38:43 +0100 + +hgview (1.6.2-1) unstable; urgency=low + + * New Upstream Release. + + -- Pierre-Yves David Wed, 08 Aug 2012 17:39:49 +0200 + +hgview (1.6.1-1) unstable; urgency=low + + * New upstream release + + -- Pierre-Yves David Wed, 08 Aug 2012 14:41:03 +0200 + +hgview (1.6.0-1) unstable; urgency=low + + * New Upstream Release + + -- Pierre-Yves David Mon, 06 Aug 2012 15:09:10 +0200 + +hgview (1.5.0-4) unstable; urgency=low + + * Rebuild the source package with the .install files so Ubuntu doesn't get + empty binary packages (LP: #929741). Oops. + + -- Julien Cristau Tue, 29 May 2012 18:13:58 +0200 + +hgview (1.5.0-3) unstable; urgency=low + + * Remove logilab.org ticket references from debian/changelog + + -- Julien Cristau Fri, 23 Dec 2011 17:39:27 +0100 + +hgview (1.5.0-2) unstable; urgency=low + + * Add missing hgpatches directory. + + -- Julien Cristau Thu, 22 Dec 2011 17:58:57 +0100 + +hgview (1.5.0-1) unstable; urgency=low + + * GUI> replace text in description for fancy display + * GUI> links in fancy view opens browser + * GUI> Add support for incoming phase feature in hg 2.1 + Node have different shape given their phase. + * TUI> fancier graph highlighting in TUI + * TUI> add history and completion for command + * TUI> display text translation in source/diff pane + * Hg> Allow toggle hidden changesets visibility + * Hg> improve mq support + * Hg> enable --profile/--time/--traceback/--debug options + as mercurial extension + * support mercurial 2.0 + * bugfixes + * others + + -- Alain Leufroy Wed, 21 Dec 2011 12:00:00 +0100 + +hgview (1.4.0-2) unstable; urgency=low + + * Fix upgrade path to 1.4. Thanks to Nicolas Chauvat for the report. + + -- Julien Cristau Thu, 29 Sep 2011 14:43:08 +0200 + +hgview (1.4.0-1) unstable; urgency=low + + * Add a new text based user interface + * Remove mx.Datetime dependency + * Don't crash/close when exploring an empty repository + * Propagate errors from mercurial.hg.repository() + + -- Alain Leufroy Mon, 26 Sep 2011 15:22:18 +0200 + +hgview (1.3.0-2) unstable; urgency=low + + * Switch to dh_python2 (closes: #637400). + + -- Julien Cristau Tue, 16 Aug 2011 16:31:54 +0200 + +hgview (1.3.0-1) unstable; urgency=low + + * New upstream release (closes: #633813) + + -- Alain Leufroy Mon, 30 May 2011 10:46:38 +0200 + +hgview (1.2.1-1) unstable; urgency=low + + * New upstream release (closes: #580997, #558767, #580921) + * Updated standards to 3.9.1 (no changes required) + + -- Alexandre Fayolle Wed, 25 Aug 2010 16:07:52 +0200 + +hgview (1.2.0-1) unstable; urgency=low + + * New upstream release + + -- David Douard Tue, 19 Jan 2010 09:02:46 +0100 + +hgview (1.1.3-1) unstable; urgency=low + + * New upstream release, adding missing files in the source tarball + * debian/control: + - changed section to 'vcs' (closes: #549162) + + -- Alexandre Fayolle Thu, 08 Oct 2009 10:55:02 +0200 + +hgview (1.1.2-1) unstable; urgency=low + + * new upstream release + * debian/control: + - fixed build dependencies to include pyqt4-dev-tools + - added missing substvars in package dependencies (closes: #548522) + + -- Alexandre Fayolle Wed, 30 Sep 2009 15:44:09 +0200 + +hgview (1.1.1-1) unstable; urgency=low + + * new upstream release + * upload to Debian (closes #409341) + + -- Alexandre Fayolle Fri, 25 Sep 2009 17:53:09 +0200 + +hgview (1.1.0-1) unstable; urgency=low + + * updated to mainstream 1.1.0 + + -- David Douard Wed, 23 Sep 2009 18:34:01 +0200 + +hgview (1.0.1-1) unstable; urgency=low + + * updated to mainstream 1.0.1 + + -- David Douard Mon, 08 Jun 2009 07:14:55 +0200 + +hgview (1.0.0-1) unstable; urgency=low + + * first stable release + + -- David Douard Thu, 05 May 2009 14:58:23 +0100 + +hgview (0.99.0-1) unstable; urgency=low + + * Fork from hgview to build a Qt4-only based application + * Make it work as a hg extension + * Rework keybindings and general navigation + * Add a diff viewer between revisions of a file + + -- David Douard Thu, 19 Feb 2009 00:58:23 +0100 + +hgview (0.9.1-1) unstable; urgency=low + + * Fix a format bug and clean code. + + -- Graziella Toutoungis Tue, 28 Oct 2008 16:24:47 +0200 + +hgview (0.9.0-1) unstable; urgency=low + + * Add support for named branches + * Activate filter on the log description and file name. + * Add Homepage field + + -- Graziella Toutoungis Mon, 06 Oct 2008 15:24:47 +0200 + +hgview (0.3.1-2) unstable; urgency=low + + * Rebuild with python2.5 as default version + + -- Alexandre.Fayolle Wed, 18 Jun 2008 12:24:47 +0200 + +hgview (0.3.1-1) unstable; urgency=low + + * Bugfixes + + -- David Douard Fri, 15 May 2008 09:48:00 +0200 + + +hgview (0.3.0-1) unstable; urgency=low + + * Added a Qt4 version + * Some bugfixes + * Major code reorganization + + -- David Douard Fri, 15 Jun 2007 12:59:12 +0200 + +hgview (0.2.0-1) unstable; urgency=low + + * first Debian package + + -- David Douard Tue, 29 May 2007 15:38:21 +0200 + --- hgview-1.7.1.orig/debian/rules +++ hgview-1.7.1/debian/rules @@ -0,0 +1,64 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. +# +# adapted by Logilab for automatic generation by debianize +# (part of the devtools project, http://www.logilab.org/projects/devtools) +# +# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE). +# http://www.logilab.fr/ -- mailto:contact@logilab.fr + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp +build-stamp: + dh_testdir + python setup.py -q build + touch build-stamp + +clean: + dh_testdir + rm -f build-stamp configure-stamp + rm -rf build + python setup.py clean + rm -f hgviewlib/qt4/*_ui.py hgviewlib/qt4/hgqv_rc.py + make -C doc clean + find . -name "*.pyc" | xargs rm -f + rm -f changelog.gz + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + python setup.py -q install --no-compile --root=$(CURDIR)/debian/tmp/ --install-layout=deb + rm -rf debian/tmp/usr/lib/python*/site-packages/hgview/test + rm -f debian/tmp/usr/lib/python*/site-packages/hgext/__init__.py* + + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_install -i --list-missing --sourcedir=debian/tmp + dh_python2 -i + dh_installchangelogs -i ChangeLog + dh_installexamples -i + dh_installdocs -i + dh_installman -i + dh_link -i + dh_compress -i -X.py -X.ini -X.xml -Xtest + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + + +binary: binary-indep +binary-arch: + +.PHONY: build clean binary binary-indep binary-arch + --- hgview-1.7.1.orig/debian/compat +++ hgview-1.7.1/debian/compat @@ -0,0 +1 @@ +5 --- hgview-1.7.1.orig/debian/hgview-curses.install +++ hgview-1.7.1/debian/hgview-curses.install @@ -0,0 +1 @@ +usr/lib/python*/*-packages/hgviewlib/curses --- hgview-1.7.1.orig/debian/hgview.install +++ hgview-1.7.1/debian/hgview.install @@ -0,0 +1 @@ +usr/lib/python*/*-packages/hgviewlib/qt4 --- hgview-1.7.1.orig/debian/source/format +++ hgview-1.7.1/debian/source/format @@ -0,0 +1 @@ +1.0 --- hgview-1.7.1.orig/bin/hgview_py2exe.py +++ hgview-1.7.1/bin/hgview_py2exe.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# hgview: visual mercurial graphlog browser in PyQt4 +# +# Copyright 2008-2010 Logilab +# +# This software may be used and distributed according to the terms +# of the GNU General Public License, incorporated herein by reference. + +""" +Hg repository log browser. + +This is a standalone version of the application built using py2exe. + +See README file included. +""" + +import sys, os +import os.path as pos + +# Standalone version of hgview built with py2exe use its own version +# of Mercurial. Using configuration from the global Mercurial.ini will be +# ill-advised as the installed version of Mercurial itself may be +# different than the one we ship. +# +# this will be found next to Mercurial.ini +path = pos.join(os.path.expanduser('~'), 'hgview.ini') +os.environ['HGRCPATH'] = path + + +# We could not import the module that defines the original class because +# of sys._Messagebox missing error (see py2exe.boot_common.py). So, we +# introspect to get access to the original class. +LOGPATH = pos.join(pos.expanduser('~'), 'hgview.log') +class Stderr(sys.stderr.__class__): + def write(self, *args, **kwargs): + kwargs['fname'] = LOGPATH + super(Stderr, self).write(*args[:2], **kwargs) +sys.stderr = Stderr() # open(pos.join(pos.expanduser('~'), 'hgview.log'), 'a') +# clean log +if pos.exists(LOGPATH): + try: + os.remove(LOGPATH) + except EnvironmentError: # could not be remove if 2 hgview are opened + pass + +from hgviewlib.application import main + +main()