D9706: shelve: open patch using new shelf class instead of open()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 8 20:37:46 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  For some reason the existing code didn't use `shelvedfile().opener()`
  so here we migrate to `shelf().open_patch()` from the `open()` system
  call instead.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -28,7 +28,6 @@
 import stat
 
 from .i18n import _
-from .pycompat import open
 from .node import (
     bin,
     hex,
@@ -672,7 +671,7 @@
         ui.write(age, label=b'shelve.age')
         ui.write(b' ' * (12 - len(age)))
         used += 12
-        with open(name + b'.' + patchextension, b'rb') as fp:
+        with Shelf(repo, sname).open_patch() as fp:
             while True:
                 line = fp.readline()
                 if not line:



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


More information about the Mercurial-devel mailing list