equal
deleted
inserted
replaced
174 Assume no ':' in key and no '\0' in both key and value.""" |
174 Assume no ':' in key and no '\0' in both key and value.""" |
175 for key, value in meta.iteritems(): |
175 for key, value in meta.iteritems(): |
176 if ':' in key or '\0' in key: |
176 if ':' in key or '\0' in key: |
177 raise ValueError("':' and '\0' are forbidden in metadata key'") |
177 raise ValueError("':' and '\0' are forbidden in metadata key'") |
178 if '\0' in value: |
178 if '\0' in value: |
179 raise ValueError("':' are forbidden in metadata value'") |
179 raise ValueError("':' is forbidden in metadata value'") |
180 return '\0'.join(['%s:%s' % (k, meta[k]) for k in sorted(meta)]) |
180 return '\0'.join(['%s:%s' % (k, meta[k]) for k in sorted(meta)]) |
181 |
181 |
182 def decodemeta(data): |
182 def decodemeta(data): |
183 """Return string to string dictionary from encoded version.""" |
183 """Return string to string dictionary from encoded version.""" |
184 d = {} |
184 d = {} |
353 _maxpayload = 5300 |
353 _maxpayload = 5300 |
354 |
354 |
355 def _pushkeyescape(markers): |
355 def _pushkeyescape(markers): |
356 """encode markers into a dict suitable for pushkey exchange |
356 """encode markers into a dict suitable for pushkey exchange |
357 |
357 |
358 - binary data is base86 encoded |
358 - binary data is base85 encoded |
359 - splitted in chunks less than 5300 bytes""" |
359 - split in chunks smaller than 5300 bytes""" |
360 keys = {} |
360 keys = {} |
361 parts = [] |
361 parts = [] |
362 currentlen = _maxpayload * 2 # ensure we create a new part |
362 currentlen = _maxpayload * 2 # ensure we create a new part |
363 for marker in markers: |
363 for marker in markers: |
364 nextdata = _encodeonemarker(marker) |
364 nextdata = _encodeonemarker(marker) |
650 # markers. |
650 # markers. |
651 # |
651 # |
652 # Within a marker, a successor may have divergent successors |
652 # Within a marker, a successor may have divergent successors |
653 # sets. In such a case, the marker will contribute multiple |
653 # sets. In such a case, the marker will contribute multiple |
654 # divergent successors sets. If multiple successors have |
654 # divergent successors sets. If multiple successors have |
655 # divergent successors sets, a cartesian product is used. |
655 # divergent successors sets, a Cartesian product is used. |
656 # |
656 # |
657 # At the end we post-process successors sets to remove |
657 # At the end we post-process successors sets to remove |
658 # duplicated entry and successors set that are strict subset of |
658 # duplicated entry and successors set that are strict subset of |
659 # another one. |
659 # another one. |
660 succssets = [] |
660 succssets = [] |
777 |
777 |
778 @cachefor('bumped') |
778 @cachefor('bumped') |
779 def _computebumpedset(repo): |
779 def _computebumpedset(repo): |
780 """the set of revs trying to obsolete public revisions""" |
780 """the set of revs trying to obsolete public revisions""" |
781 bumped = set() |
781 bumped = set() |
782 # utils function (avoid attribute lookup in the loop) |
782 # util function (avoid attribute lookup in the loop) |
783 phase = repo._phasecache.phase # would be faster to grab the full list |
783 phase = repo._phasecache.phase # would be faster to grab the full list |
784 public = phases.public |
784 public = phases.public |
785 cl = repo.changelog |
785 cl = repo.changelog |
786 torev = cl.nodemap.get |
786 torev = cl.nodemap.get |
787 obs = getrevs(repo, 'obsolete') |
787 obs = getrevs(repo, 'obsolete') |
823 |
823 |
824 def createmarkers(repo, relations, flag=0, metadata=None): |
824 def createmarkers(repo, relations, flag=0, metadata=None): |
825 """Add obsolete markers between changesets in a repo |
825 """Add obsolete markers between changesets in a repo |
826 |
826 |
827 <relations> must be an iterable of (<old>, (<new>, ...)[,{metadata}]) |
827 <relations> must be an iterable of (<old>, (<new>, ...)[,{metadata}]) |
828 tuple. `old` and `news` are changectx. metadata is an optional dictionnary |
828 tuple. `old` and `news` are changectx. metadata is an optional dictionary |
829 containing metadata for this marker only. It is merged with the global |
829 containing metadata for this marker only. It is merged with the global |
830 metadata specified through the `metadata` argument of this function, |
830 metadata specified through the `metadata` argument of this function, |
831 |
831 |
832 Trying to obsolete a public changeset will raise an exception. |
832 Trying to obsolete a public changeset will raise an exception. |
833 |
833 |