Mercurial > evolve
comparison hgext/simple4server.py @ 1091:236a8e81551e
compat: use in-core encodemarkers
Now exist in core witha slightly different format.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 27 Aug 2014 18:16:10 +0200 |
parents | 4a6479395a9d |
children | 580a2d838996 |
comparison
equal
deleted
inserted
replaced
1090:4a6479395a9d | 1091:236a8e81551e |
---|---|
73 finally: | 73 finally: |
74 lock.release() | 74 lock.release() |
75 repo.hook('evolve_pushobsmarkers') | 75 repo.hook('evolve_pushobsmarkers') |
76 return wireproto.pushres(0) | 76 return wireproto.pushres(0) |
77 | 77 |
78 # from mercurial.obsolete: 19e9478c1a22 | |
79 def _encodemarkersstream(fp, markers): | |
80 """write a binary version of a set of markers | |
81 | |
82 Includes the initial version number""" | |
83 fp.write(_pack('>B', 0)) | |
84 for mark in markers: | |
85 fp.write(obsolete._encodeonemarker(mark)) | |
86 | |
87 # from evolve extension: 1a23c7c52a43 | 78 # from evolve extension: 1a23c7c52a43 |
88 def _getobsmarkersstream(repo, heads=None, common=None): | 79 def _getobsmarkersstream(repo, heads=None, common=None): |
89 """Get a binary stream for all markers relevant to `::<heads> - ::<common>` | 80 """Get a binary stream for all markers relevant to `::<heads> - ::<common>` |
90 """ | 81 """ |
91 revset = '' | 82 revset = '' |
102 revset += ' - (::%ln)' | 93 revset += ' - (::%ln)' |
103 args.append(common) | 94 args.append(common) |
104 nodes = [c.node() for c in repo.set(revset, *args)] | 95 nodes = [c.node() for c in repo.set(revset, *args)] |
105 markers = repo.obsstore.relevantmarkers(nodes) | 96 markers = repo.obsstore.relevantmarkers(nodes) |
106 obsdata = StringIO() | 97 obsdata = StringIO() |
107 _encodemarkersstream(obsdata, markers) | 98 for chunk in obsolete.encodemarkers(markers, True): |
99 obsdata.write(chunk) | |
108 obsdata.seek(0) | 100 obsdata.seek(0) |
109 return obsdata | 101 return obsdata |
110 | 102 |
111 if not util.safehasattr(obsolete.obsstore, 'relevantmarkers'): | 103 if not util.safehasattr(obsolete.obsstore, 'relevantmarkers'): |
112 # from evolve extension: 1a23c7c52a43 | 104 # from evolve extension: 1a23c7c52a43 |