Show More
@@ -39,6 +39,10 REVISION_FLAG_EXTSTORED = 1 << 13 | |||||
39 | REVISION_FLAGS_KNOWN = ( |
|
39 | REVISION_FLAGS_KNOWN = ( | |
40 | REVISION_FLAG_CENSORED | REVISION_FLAG_ELLIPSIS | REVISION_FLAG_EXTSTORED) |
|
40 | REVISION_FLAG_CENSORED | REVISION_FLAG_ELLIPSIS | REVISION_FLAG_EXTSTORED) | |
41 |
|
41 | |||
|
42 | CG_DELTAMODE_STD = b'default' | |||
|
43 | CG_DELTAMODE_PREV = b'previous' | |||
|
44 | CG_DELTAMODE_FULL = b'fulltext' | |||
|
45 | ||||
42 | class ipeerconnection(interfaceutil.Interface): |
|
46 | class ipeerconnection(interfaceutil.Interface): | |
43 | """Represents a "connection" to a repository. |
|
47 | """Represents a "connection" to a repository. | |
44 |
|
48 |
@@ -2213,6 +2213,12 class revlog(object): | |||||
2213 | if nodesorder is None and not self._generaldelta: |
|
2213 | if nodesorder is None and not self._generaldelta: | |
2214 | nodesorder = 'storage' |
|
2214 | nodesorder = 'storage' | |
2215 |
|
2215 | |||
|
2216 | deltamode = repository.CG_DELTAMODE_STD | |||
|
2217 | if deltaprevious: | |||
|
2218 | deltamode = repository.CG_DELTAMODE_PREV | |||
|
2219 | elif not self._storedeltachains: | |||
|
2220 | deltamode = repository.CG_DELTAMODE_FULL | |||
|
2221 | ||||
2216 | return storageutil.emitrevisions( |
|
2222 | return storageutil.emitrevisions( | |
2217 | self, nodes, nodesorder, revlogrevisiondelta, |
|
2223 | self, nodes, nodesorder, revlogrevisiondelta, | |
2218 | deltaparentfn=self.deltaparent, |
|
2224 | deltaparentfn=self.deltaparent, | |
@@ -2220,10 +2226,9 class revlog(object): | |||||
2220 | rawsizefn=self.rawsize, |
|
2226 | rawsizefn=self.rawsize, | |
2221 | revdifffn=self.revdiff, |
|
2227 | revdifffn=self.revdiff, | |
2222 | flagsfn=self.flags, |
|
2228 | flagsfn=self.flags, | |
2223 | sendfulltext=not self._storedeltachains, |
|
2229 | deltamode=deltamode, | |
2224 | revisiondata=revisiondata, |
|
2230 | revisiondata=revisiondata, | |
2225 |
assumehaveparentrevisions=assumehaveparentrevisions |
|
2231 | assumehaveparentrevisions=assumehaveparentrevisions) | |
2226 | deltaprevious=deltaprevious) |
|
|||
2227 |
|
2232 | |||
2228 | DELTAREUSEALWAYS = 'always' |
|
2233 | DELTAREUSEALWAYS = 'always' | |
2229 | DELTAREUSESAMEREVS = 'samerevs' |
|
2234 | DELTAREUSESAMEREVS = 'samerevs' |
@@ -22,6 +22,7 from .. import ( | |||||
22 | error, |
|
22 | error, | |
23 | mdiff, |
|
23 | mdiff, | |
24 | pycompat, |
|
24 | pycompat, | |
|
25 | repository, | |||
25 | ) |
|
26 | ) | |
26 |
|
27 | |||
27 | _nullhash = hashlib.sha1(nullid) |
|
28 | _nullhash = hashlib.sha1(nullid) | |
@@ -269,9 +270,8 def resolvestripinfo(minlinkrev, tiprev, | |||||
269 |
|
270 | |||
270 | def emitrevisions(store, nodes, nodesorder, resultcls, deltaparentfn=None, |
|
271 | def emitrevisions(store, nodes, nodesorder, resultcls, deltaparentfn=None, | |
271 | candeltafn=None, rawsizefn=None, revdifffn=None, flagsfn=None, |
|
272 | candeltafn=None, rawsizefn=None, revdifffn=None, flagsfn=None, | |
272 | sendfulltext=False, |
|
273 | deltamode=repository.CG_DELTAMODE_STD, | |
273 |
revisiondata=False, assumehaveparentrevisions=False |
|
274 | revisiondata=False, assumehaveparentrevisions=False): | |
274 | deltaprevious=False): |
|
|||
275 | """Generic implementation of ifiledata.emitrevisions(). |
|
275 | """Generic implementation of ifiledata.emitrevisions(). | |
276 |
|
276 | |||
277 | Emitting revision data is subtly complex. This function attempts to |
|
277 | Emitting revision data is subtly complex. This function attempts to | |
@@ -322,14 +322,17 def emitrevisions(store, nodes, nodesord | |||||
322 | Callable receiving a revision number and returns the integer flags |
|
322 | Callable receiving a revision number and returns the integer flags | |
323 | value for it. If not defined, flags value will be 0. |
|
323 | value for it. If not defined, flags value will be 0. | |
324 |
|
324 | |||
325 |
`` |
|
325 | ``deltamode`` | |
|
326 | constaint on delta to be sent: | |||
|
327 | * CG_DELTAMODE_STD - normal mode, try to reuse storage deltas, | |||
|
328 | * CG_DELTAMODE_PREV - only delta against "prev", | |||
|
329 | * CG_DELTAMODE_FULL - only issue full snapshot. | |||
|
330 | ||||
326 | Whether to send fulltext revisions instead of deltas, if allowed. |
|
331 | Whether to send fulltext revisions instead of deltas, if allowed. | |
327 |
|
332 | |||
328 | ``nodesorder`` |
|
333 | ``nodesorder`` | |
329 | ``revisiondata`` |
|
334 | ``revisiondata`` | |
330 | ``assumehaveparentrevisions`` |
|
335 | ``assumehaveparentrevisions`` | |
331 | ``deltaprevious`` |
|
|||
332 | See ``ifiledata.emitrevisions()`` interface documentation. |
|
|||
333 | """ |
|
336 | """ | |
334 |
|
337 | |||
335 | fnode = store.node |
|
338 | fnode = store.node | |
@@ -345,7 +348,7 def emitrevisions(store, nodes, nodesord | |||||
345 |
|
348 | |||
346 | prevrev = None |
|
349 | prevrev = None | |
347 |
|
350 | |||
348 |
if delta |
|
351 | if deltamode == repository.CG_DELTAMODE_PREV or assumehaveparentrevisions: | |
349 | prevrev = store.parentrevs(revs[0])[0] |
|
352 | prevrev = store.parentrevs(revs[0])[0] | |
350 |
|
353 | |||
351 | # Set of revs available to delta against. |
|
354 | # Set of revs available to delta against. | |
@@ -364,11 +367,11 def emitrevisions(store, nodes, nodesord | |||||
364 | deltaparentrev = nullrev |
|
367 | deltaparentrev = nullrev | |
365 |
|
368 | |||
366 | # Forced delta against previous mode. |
|
369 | # Forced delta against previous mode. | |
367 | if deltaprevious: |
|
370 | if deltamode == repository.CG_DELTAMODE_PREV: | |
368 | baserev = prevrev |
|
371 | baserev = prevrev | |
369 |
|
372 | |||
370 | # We're instructed to send fulltext. Honor that. |
|
373 | # We're instructed to send fulltext. Honor that. | |
371 | elif sendfulltext: |
|
374 | elif deltamode == repository.CG_DELTAMODE_FULL: | |
372 | baserev = nullrev |
|
375 | baserev = nullrev | |
373 |
|
376 | |||
374 | # There is a delta in storage. We try to use that because it |
|
377 | # There is a delta in storage. We try to use that because it | |
@@ -427,7 +430,8 def emitrevisions(store, nodes, nodesord | |||||
427 | baserevisionsize = len(store.revision(baserev, |
|
430 | baserevisionsize = len(store.revision(baserev, | |
428 | raw=True)) |
|
431 | raw=True)) | |
429 |
|
432 | |||
430 |
elif baserev == nullrev |
|
433 | elif (baserev == nullrev | |
|
434 | and deltamode != repository.CG_DELTAMODE_PREV): | |||
431 | revision = store.revision(node, raw=True) |
|
435 | revision = store.revision(node, raw=True) | |
432 | available.add(rev) |
|
436 | available.add(rev) | |
433 | else: |
|
437 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now