Mercurial > hg
changeset 46275:157305bf859f
shelve: move method for reading .shelve file to new shelf class
Differential Revision: https://phab.mercurial-scm.org/D9702
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Jan 2021 11:28:41 -0800 |
parents | a344ec05b99c |
children | eb7b2929ae49 |
files | mercurial/shelve.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/shelve.py Thu Jan 07 11:22:21 2021 -0800 +++ b/mercurial/shelve.py Thu Jan 07 11:28:41 2021 -0800 @@ -163,9 +163,6 @@ self.ui, cg, self.fname, btype, self.vfs, compression=compression ) - def readinfo(self): - return scmutil.simplekeyvaluefile(self.vfs, self.fname).read() - class Shelf(object): """Represents a shelf, including possibly multiple files storing it. @@ -186,6 +183,11 @@ def writeinfo(self, info): scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info) + def readinfo(self): + return scmutil.simplekeyvaluefile( + self.vfs, self.name + b'.shelve' + ).read() + class shelvedstate(object): """Handle persistence during unshelving operations. @@ -894,7 +896,7 @@ repo = repo.unfiltered() node = None if shelvedfile(repo, basename, b'shelve').exists(): - node = shelvedfile(repo, basename, b'shelve').readinfo()[b'node'] + node = Shelf(repo, basename).readinfo()[b'node'] if node is None or node not in repo: with ui.configoverride({(b'ui', b'quiet'): True}): shelvectx = shelvedfile(repo, basename, b'hg').applybundle(tr)