[PATCH 1 of 3] transaction: always remove empty journal on abort

Benoit Boissinot benoit.boissinot at ens-lyon.org
Sat Oct 31 09:18:55 CDT 2009


On Fri, Oct 30, 2009 at 05:42:42PM +0100, Sune Foldager wrote:
> # HG changeset patch
> # User Sune Foldager <cryo at cyanite.org>
> # Date 1256920863 -3600
> # Node ID 035e516c15acca1abb1ce845bc1ec9ade88f3c20
> # Parent  5bbf4f130684e27ce4491ea31fbe1629dcc4ebdb
> transaction: always remove empty journal on abort
> 
> When transactions without entries were aborted, the journal (of size 0) was not
> unlinked, which prevents subsequent operations until hg recover is run on the
> repository.

ACK
> 
> We also make sure the journal is unlinked when committing, even if the provided
> hook doesn't do so.
> 
> diff --git a/mercurial/transaction.py b/mercurial/transaction.py
> --- a/mercurial/transaction.py
> +++ b/mercurial/transaction.py
> @@ -126,6 +125,8 @@
>          self.entries = []
>          if self.after:
>              self.after()
> +            if os.path.isfile(self.journal):
> +                os.unlink(self.journal)
>          else:
>              os.unlink(self.journal)

Why this? self.after() will move the file anyway.

regards,

Benoit
-- 
:wq


More information about the Mercurial-devel mailing list