##// END OF EJS Templates
shelve: move function for opening .patch file to new shelf class...
Martin von Zweigbergk -
r46904:d20cc280 default draft
parent child Browse files
Show More
@@ -114,9 +114,6 b' class shelvedfile(object):'
114 def stat(self):
114 def stat(self):
115 return self.vfs.stat(self.fname)
115 return self.vfs.stat(self.fname)
116
116
117 def opener(self, mode=b'rb'):
118 return self.vfs(self.fname, mode)
119
120
117
121 class Shelf(object):
118 class Shelf(object):
122 """Represents a shelf, including possibly multiple files storing it.
119 """Represents a shelf, including possibly multiple files storing it.
@@ -193,6 +190,9 b' class Shelf(object):'
193 finally:
190 finally:
194 fp.close()
191 fp.close()
195
192
193 def open_patch(self, mode=b'rb'):
194 return self.vfs(self.name + b'.patch', mode)
195
196
196
197 class shelvedstate(object):
197 class shelvedstate(object):
198 """Handle persistence during unshelving operations.
198 """Handle persistence during unshelving operations.
@@ -481,7 +481,7 b' def _shelvecreatedcommit(repo, node, nam'
481 Shelf(repo, name).writeinfo(info)
481 Shelf(repo, name).writeinfo(info)
482 bases = list(mutableancestors(repo[node]))
482 bases = list(mutableancestors(repo[node]))
483 Shelf(repo, name).writebundle(bases, node)
483 Shelf(repo, name).writebundle(bases, node)
484 with shelvedfile(repo, name, patchextension).opener(b'wb') as fp:
484 with Shelf(repo, name).open_patch(b'wb') as fp:
485 cmdutil.exportfile(
485 cmdutil.exportfile(
486 repo, [node], fp, opts=mdiff.diffopts(git=True), match=match
486 repo, [node], fp, opts=mdiff.diffopts(git=True), match=match
487 )
487 )
General Comments 0
You need to be logged in to leave comments. Login now