First I have replaced control statement that are invalid in py24:
- try ... except ... finally only appears in py25
- yield is forbidden inside a try ... finally
Then the RPM spec file has been modified so that:
- the mandatory --vendor option is a nil operation as it use the same
name as the prefix
- egg-info is not generated on older platform (typically py2.4)
diff -r d5cd872f61fd -r a1d82d5eb040 contrib/tortoisehg.spec
--- a/contrib/tortoisehg.spec Fri Apr 01 13:50:10 2011 -0500
+++ b/contrib/tortoisehg.spec Wed Apr 20 08:17:43 2011 +0200
@@ -67,7 +67,7 @@
install contrib/mergetools.rc $RPM_BUILD_ROOT%{_sysconfdir}/mercurial/hgrc.d/thgmergetools.rc
ln -s tortoisehg/icons/svg/thg_logo.svg %{buildroot}%{_datadir}/pixmaps/%{name}_logo.svg
-desktop-file-install --dir=%{buildroot}%{_datadir}/applications contrib/%{name}.desktop
+desktop-file-install --dir=%{buildroot}%{_datadir}/applications contrib/%{name}.desktop --vendor %{name}
%find_lang %{name}
@@ -80,7 +80,9 @@
%doc COPYING.txt doc/build/html/
%{_bindir}/thg
%{python_sitelib}/tortoisehg/
+%if "%{?pythonver}" > "2.4"
%{python_sitelib}/tortoisehg-*.egg-info
+%endif
%{_datadir}/pixmaps/tortoisehg/
%{_datadir}/pixmaps/%{name}_logo.svg
%{_datadir}/applications/%{name}.desktop
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/annotate.py
--- a/tortoisehg/hgqt/annotate.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/annotate.py Wed Apr 20 08:17:43 2011 +0200
@@ -344,12 +344,13 @@
assert self.currentThread() != qApp.thread()
self._threadid = self.currentThreadId()
try:
- data = []
- for (fctx, line), _text in self._fctx.annotate(True, True):
- data.append((fctx, line))
- self.data = data
- except KeyboardInterrupt:
- pass
+ try:
+ data = []
+ for (fctx, line), _text in self._fctx.annotate(True, True):
+ data.append((fctx, line))
+ self.data = data
+ except KeyboardInterrupt:
+ pass
finally:
self._threadid = None
del self._fctx
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/repotreeitem.py
--- a/tortoisehg/hgqt/repotreeitem.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/repotreeitem.py Wed Apr 20 08:17:43 2011 +0200
@@ -210,12 +210,13 @@
def startSettings(self, parent):
try:
- dlg = SettingsDialog(configrepo=True, focus='web.name', parent=parent,
- root=self._root)
- self.ensureRepoLoaded()
- dlg.exec_()
- except error.RepoError:
- pass
+ try:
+ dlg = SettingsDialog(configrepo=True, focus='web.name', parent=parent,
+ root=self._root)
+ self.ensureRepoLoaded()
+ dlg.exec_()
+ except error.RepoError:
+ pass
finally:
dlg.deleteLater()
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/run.py
--- a/tortoisehg/hgqt/run.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/run.py Wed Apr 20 08:17:43 2011 +0200
@@ -397,12 +397,13 @@
def excepthandler(self):
'Display exception info; run in main (GUI) thread'
try:
- self._showexceptiondialog()
- except:
- # make sure to quit mainloop first, so that it never leave
- # zombie process.
- self._mainapp.exit(1)
- self._printexception()
+ try:
+ self._showexceptiondialog()
+ except:
+ # make sure to quit mainloop first, so that it never leave
+ # zombie process.
+ self._mainapp.exit(1)
+ self._printexception()
finally:
self.errors = []
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/serve.py
--- a/tortoisehg/hgqt/serve.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/serve.py Wed Apr 20 08:17:43 2011 +0200
@@ -133,11 +133,12 @@
origtimeout = socket.getdefaulttimeout()
socket.setdefaulttimeout(TIMEOUT)
try:
- conn.request('GET', '/')
- res = conn.getresponse()
- res.read()
- except (socket.error, httplib.HTTPException):
- pass
+ try:
+ conn.request('GET', '/')
+ res = conn.getresponse()
+ res.read()
+ except (socket.error, httplib.HTTPException):
+ pass
finally:
socket.setdefaulttimeout(origtimeout)
conn.close()
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/sync.py
--- a/tortoisehg/hgqt/sync.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/sync.py Wed Apr 20 08:17:43 2011 +0200
@@ -506,11 +506,12 @@
if shell:
cwd = os.getcwd()
try:
- os.chdir(folder)
- QProcess.startDetached(shell)
- except EnvironmentError, e:
- qtlib.InfoMsgBox(_('Repository not found'),
- hglib.tounicode(str(e)))
+ try:
+ os.chdir(folder)
+ QProcess.startDetached(shell)
+ except EnvironmentError, e:
+ qtlib.InfoMsgBox(_('Repository not found'),
+ hglib.tounicode(str(e)))
finally:
os.chdir(cwd)
else:
diff -r d5cd872f61fd -r a1d82d5eb040 tortoisehg/hgqt/thgrepo.py
--- a/tortoisehg/hgqt/thgrepo.py Fri Apr 01 13:50:10 2011 -0500
+++ b/tortoisehg/hgqt/thgrepo.py Wed Apr 20 08:17:43 2011 +0200
@@ -611,5 +611,8 @@
for e in repotreemodel.iterRepoItemFromXml(f):
if e.basenode() == repoid:
yield e.rootpath(), e.shortname()
- finally:
+ except:
f.close()
+ raise
+ else:
+ f.close()
Looks good, pushed to stable. Care to give the default branch a quick
test to see if there are any remaining problems there?
--
Steve Borho
Does this patch to thg resolve it?
@@ -68,5 +68,8 @@
qtrun(run, ui, **opts)
sys.exit(1)
-ret = tortoisehg.hgqt.run.dispatch(sys.argv[1:])
+try:
+ ret = tortoisehg.hgqt.run.dispatch(sys.argv[1:])
+except SystemExit, e:
+ ret = e.code
sys.exit(ret)
--
Steve Borho
That's the ellipsis added by the longsummary() method in thgrepo.py
But I have no idea why it's causing that problem. You may have to add
some debugging to repomodel to figure out where the exception is
coming from (see the rawdata() method)
--
Steve Borho
Yeah, I saw in the docs that in 2.5 that exception was changed to
derive from a different base exception. So with 2.4 it is being
picked up in our generic exception handler in run.py. I'll see if I
can make a better patch.
--
Steve Borho
That's the ellipsis added by the longsummary() method in thgrepo.py
But I have no idea why it's causing that problem. You may have to add
some debugging to repomodel to figure out where the exception is
coming from (see the rawdata() method)
--
Steve Borho
# Date 1303453596 -7200
# Node ID faf2f027c28a3c6bd5691bf9d133a36ea94b984c
# Parent 87fbc0d06adf86f5a1cc2ac46bbd6e5fced11b18
qtlib: force unicode for the markup strings
diff -r 87fbc0d06adf -r faf2f027c28a tortoisehg/hgqt/qtlib.py
--- a/tortoisehg/hgqt/qtlib.py Wed Apr 20 22:47:48 2011 -0500
+++ b/tortoisehg/hgqt/qtlib.py Fri Apr 22 08:26:36 2011 +0200
@@ -291,7 +291,7 @@
msg = hglib.tounicode(msg)
msg = Qt.escape(msg)
msg = msg.replace('\n', '<br />')
- return '<span style="%s">%s</span>' % (style, msg)
+ return u'<span style="%s">%s</span>' % (style, msg)
def descriptionhtmlizer(ui):
"""Return a function to mark up ctx.description() as an HTML
Regards.
Gilles.
Sure, done.
--
Steve Borho