##// END OF EJS Templates
shelve: move method for reading .shelve file to new shelf class...
Martin von Zweigbergk -
r46901:2e14b933 default draft
parent child Browse files
Show More
@@ -163,9 +163,6 b' class shelvedfile(object):'
163 self.ui, cg, self.fname, btype, self.vfs, compression=compression
163 self.ui, cg, self.fname, btype, self.vfs, compression=compression
164 )
164 )
165
165
166 def readinfo(self):
167 return scmutil.simplekeyvaluefile(self.vfs, self.fname).read()
168
169
166
170 class Shelf(object):
167 class Shelf(object):
171 """Represents a shelf, including possibly multiple files storing it.
168 """Represents a shelf, including possibly multiple files storing it.
@@ -186,6 +183,11 b' class Shelf(object):'
186 def writeinfo(self, info):
183 def writeinfo(self, info):
187 scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
184 scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
188
185
186 def readinfo(self):
187 return scmutil.simplekeyvaluefile(
188 self.vfs, self.name + b'.shelve'
189 ).read()
190
189
191
190 class shelvedstate(object):
192 class shelvedstate(object):
191 """Handle persistence during unshelving operations.
193 """Handle persistence during unshelving operations.
@@ -894,7 +896,7 b' def _unshelverestorecommit(ui, repo, tr,'
894 repo = repo.unfiltered()
896 repo = repo.unfiltered()
895 node = None
897 node = None
896 if shelvedfile(repo, basename, b'shelve').exists():
898 if shelvedfile(repo, basename, b'shelve').exists():
897 node = shelvedfile(repo, basename, b'shelve').readinfo()[b'node']
899 node = Shelf(repo, basename).readinfo()[b'node']
898 if node is None or node not in repo:
900 if node is None or node not in repo:
899 with ui.configoverride({(b'ui', b'quiet'): True}):
901 with ui.configoverride({(b'ui', b'quiet'): True}):
900 shelvectx = shelvedfile(repo, basename, b'hg').applybundle(tr)
902 shelvectx = shelvedfile(repo, basename, b'hg').applybundle(tr)
General Comments 0
You need to be logged in to leave comments. Login now