##// END OF EJS Templates
shelve: move method for writing .shelve to new shelf class...
Martin von Zweigbergk -
r46992:a344ec05 default
parent child Browse files
Show More
@@ -163,9 +163,6 b' class shelvedfile(object):'
163 163 self.ui, cg, self.fname, btype, self.vfs, compression=compression
164 164 )
165 165
166 def writeinfo(self, info):
167 scmutil.simplekeyvaluefile(self.vfs, self.fname).write(info)
168
169 166 def readinfo(self):
170 167 return scmutil.simplekeyvaluefile(self.vfs, self.fname).read()
171 168
@@ -186,6 +183,9 b' class Shelf(object):'
186 183 def exists(self):
187 184 return self.vfs.exists(self.name + b'.' + patchextension)
188 185
186 def writeinfo(self, info):
187 scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
188
189 189
190 190 class shelvedstate(object):
191 191 """Handle persistence during unshelving operations.
@@ -471,7 +471,7 b' def _nothingtoshelvemessaging(ui, repo, '
471 471
472 472 def _shelvecreatedcommit(repo, node, name, match):
473 473 info = {b'node': hex(node)}
474 shelvedfile(repo, name, b'shelve').writeinfo(info)
474 Shelf(repo, name).writeinfo(info)
475 475 bases = list(mutableancestors(repo[node]))
476 476 shelvedfile(repo, name, b'hg').writebundle(bases, node)
477 477 with shelvedfile(repo, name, patchextension).opener(b'wb') as fp:
@@ -902,7 +902,7 b' def _unshelverestorecommit(ui, repo, tr,'
902 902 # the unshelve node in case we need to reuse it (eg: unshelve --keep)
903 903 if node is None:
904 904 info = {b'node': hex(shelvectx.node())}
905 shelvedfile(repo, basename, b'shelve').writeinfo(info)
905 Shelf(repo, basename).writeinfo(info)
906 906 else:
907 907 shelvectx = repo[node]
908 908
General Comments 0
You need to be logged in to leave comments. Login now