Show More
@@ -84,7 +84,6 b' class shelvedfile(object):' | |||||
84 | self.name = name |
|
84 | self.name = name | |
85 | self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) |
|
85 | self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) | |
86 | self.backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) |
|
86 | self.backupvfs = vfsmod.vfs(repo.vfs.join(backupdir)) | |
87 | self.ui = self.repo.ui |
|
|||
88 | if filetype: |
|
87 | if filetype: | |
89 | self.fname = name + b'.' + filetype |
|
88 | self.fname = name + b'.' + filetype | |
90 | else: |
|
89 | else: | |
@@ -143,26 +142,6 b' class shelvedfile(object):' | |||||
143 | finally: |
|
142 | finally: | |
144 | fp.close() |
|
143 | fp.close() | |
145 |
|
144 | |||
146 | def writebundle(self, bases, node): |
|
|||
147 | cgversion = changegroup.safeversion(self.repo) |
|
|||
148 | if cgversion == b'01': |
|
|||
149 | btype = b'HG10BZ' |
|
|||
150 | compression = None |
|
|||
151 | else: |
|
|||
152 | btype = b'HG20' |
|
|||
153 | compression = b'BZ' |
|
|||
154 |
|
||||
155 | repo = self.repo.unfiltered() |
|
|||
156 |
|
||||
157 | outgoing = discovery.outgoing( |
|
|||
158 | repo, missingroots=bases, ancestorsof=[node] |
|
|||
159 | ) |
|
|||
160 | cg = changegroup.makechangegroup(repo, outgoing, cgversion, b'shelve') |
|
|||
161 |
|
||||
162 | bundle2.writebundle( |
|
|||
163 | self.ui, cg, self.fname, btype, self.vfs, compression=compression |
|
|||
164 | ) |
|
|||
165 |
|
||||
166 |
|
145 | |||
167 | class Shelf(object): |
|
146 | class Shelf(object): | |
168 | """Represents a shelf, including possibly multiple files storing it. |
|
147 | """Represents a shelf, including possibly multiple files storing it. | |
@@ -188,6 +167,32 b' class Shelf(object):' | |||||
188 | self.vfs, self.name + b'.shelve' |
|
167 | self.vfs, self.name + b'.shelve' | |
189 | ).read() |
|
168 | ).read() | |
190 |
|
169 | |||
|
170 | def writebundle(self, bases, node): | |||
|
171 | cgversion = changegroup.safeversion(self.repo) | |||
|
172 | if cgversion == b'01': | |||
|
173 | btype = b'HG10BZ' | |||
|
174 | compression = None | |||
|
175 | else: | |||
|
176 | btype = b'HG20' | |||
|
177 | compression = b'BZ' | |||
|
178 | ||||
|
179 | repo = self.repo.unfiltered() | |||
|
180 | ||||
|
181 | outgoing = discovery.outgoing( | |||
|
182 | repo, missingroots=bases, ancestorsof=[node] | |||
|
183 | ) | |||
|
184 | cg = changegroup.makechangegroup(repo, outgoing, cgversion, b'shelve') | |||
|
185 | ||||
|
186 | bundle_filename = self.vfs.join(self.name + b'.hg') | |||
|
187 | bundle2.writebundle( | |||
|
188 | self.repo.ui, | |||
|
189 | cg, | |||
|
190 | bundle_filename, | |||
|
191 | btype, | |||
|
192 | self.vfs, | |||
|
193 | compression=compression, | |||
|
194 | ) | |||
|
195 | ||||
191 |
|
196 | |||
192 | class shelvedstate(object): |
|
197 | class shelvedstate(object): | |
193 | """Handle persistence during unshelving operations. |
|
198 | """Handle persistence during unshelving operations. | |
@@ -475,7 +480,7 b' def _shelvecreatedcommit(repo, node, nam' | |||||
475 | info = {b'node': hex(node)} |
|
480 | info = {b'node': hex(node)} | |
476 | Shelf(repo, name).writeinfo(info) |
|
481 | Shelf(repo, name).writeinfo(info) | |
477 | bases = list(mutableancestors(repo[node])) |
|
482 | bases = list(mutableancestors(repo[node])) | |
478 |
|
|
483 | Shelf(repo, name).writebundle(bases, node) | |
479 | with shelvedfile(repo, name, patchextension).opener(b'wb') as fp: |
|
484 | with shelvedfile(repo, name, patchextension).opener(b'wb') as fp: | |
480 | cmdutil.exportfile( |
|
485 | cmdutil.exportfile( | |
481 | repo, [node], fp, opts=mdiff.diffopts(git=True), match=match |
|
486 | repo, [node], fp, opts=mdiff.diffopts(git=True), match=match |
General Comments 0
You need to be logged in to leave comments.
Login now