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

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


On Sat, Oct 31, 2009 at 03:38:54PM +0100, Sune Foldager wrote:
> 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.

If that's your concern, then we can put it outside the if:

if self.after:
    self.after()
if os.path.exists(self.journal):
    os.unlink(self.journal)

regards,

Benoit
-- 
:wq


More information about the Mercurial-devel mailing list