[SoC] Rebase feature - Introduction

Javier Merino cibervicho at gmail.com
Mon May 26 13:20:42 CDT 2008


2008/5/26 Stefano Tortarolo <stefano.tortarolo at gmail.com>:
> while the code is here: http://freehg.org/u/astratto/soc/
>
>
> Any suggestions will be very appreciated.
> Thank you

Using except and finally in the same try statement is only supported
since Python 2.5 [0]. However mercurial should be able to run with
Python 2.3 or greater. I think this patch corrects it

[0] http://docs.python.org/tut/node10.html#SECTION0010600000000000000000

Regards,
Javier Merino (Vicho)

# HG changeset patch
# User Javier Merino <cibervicho at gmail.com>
# Date 1211825568 -7200
# Node ID 51bca89a560f5a3b3e7d662cc9705a351d73133c
# Parent  e8abd3ec839a24b9e5a7a23d979b12efd76ce88d
Avoid try,except,finally clauses because that requires Python 2.5

diff -r e8abd3ec839a -r 51bca89a560f rebase.py
--- a/rebase.py Mon May 26 15:53:46 2008 +0200
+++ b/rebase.py Mon May 26 20:12:48 2008 +0200
@@ -200,8 +200,9 @@
                                                 self.repo.lookup(parent2))
         except Exception, inst:
             print inst
+            del wlock
             raise util.Abort(_('Error while removing parents of %s\n') % rev)
-        finally:
+        else:
             del wlock

     def _merge(self, target, local):
@@ -217,8 +218,9 @@
                 raise util.Abort(_('unresolved changes. Aborting'))
         except Exception, inst:
                 self.ui.status(_(inst))
+                del wlock
                 raise util.Abort(_('merge failed.'))
-        finally:
+        else:
             del wlock

     def _commit(self, msg, user):
@@ -232,8 +234,9 @@
         except Exception, inst:
             ## NEED a better solution
             print inst
+            del wlock
             raise util.Abort(_('Commit failed'))
-        finally:
+        else:
             del wlock

     def _strip(self, rev, urev, backup="strip"):


More information about the Mercurial-devel mailing list