Patchwork D10845: transaction: narrow the error filtering when failing to rename undo file

login
register
mail settings
Submitter phabricator
Date June 9, 2021, 2:38 p.m.
Message ID <differential-rev-PHID-DREV-ng42f5dknqbm4ljkywoh-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49167/
State Superseded
Headers show

Comments

phabricator - June 9, 2021, 2:38 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Having inconsistent "undo" files can be quite serious so we narrow the error
  filtering to the intent that the comment explain.
  
  (This is an opportunity improvement while looking at something next to that.)

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10845

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3445,8 +3445,9 @@ 
             vfs.tryunlink(dest)
             try:
                 vfs.rename(src, dest)
-            except OSError:  # journal file does not yet exist
-                pass
+            except OSError as exc:  # journal file does not yet exist
+                if exc.errno != errno.ENOENT:
+                    raise
 
     return a