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

Sune Foldager cryo at cyanite.org
Sat Oct 31 09:38:54 CDT 2009


Benoit Boissinot wrote:
>
>> 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.
>   
The after used from localrepo will, sure, but perhaps a future use of 
the transaction class will pass an after-hook which won't remove the file.

/Sune



More information about the Mercurial-devel mailing list