463 if addheader: |
463 if addheader: |
464 yield encodeheader(version) |
464 yield encodeheader(version) |
465 for marker in markers: |
465 for marker in markers: |
466 yield encodeone(marker) |
466 yield encodeone(marker) |
467 |
467 |
468 |
|
469 class marker(object): |
|
470 """Wrap obsolete marker raw data""" |
|
471 |
|
472 def __init__(self, repo, data): |
|
473 # the repo argument will be used to create changectx in later version |
|
474 self._repo = repo |
|
475 self._data = data |
|
476 self._decodedmeta = None |
|
477 |
|
478 def __hash__(self): |
|
479 return hash(self._data) |
|
480 |
|
481 def __eq__(self, other): |
|
482 if type(other) != type(self): |
|
483 return False |
|
484 return self._data == other._data |
|
485 |
|
486 def precnode(self): |
|
487 """Precursor changeset node identifier""" |
|
488 return self._data[0] |
|
489 |
|
490 def succnodes(self): |
|
491 """List of successor changesets node identifiers""" |
|
492 return self._data[1] |
|
493 |
|
494 def parentnodes(self): |
|
495 """Parents of the precursors (None if not recorded)""" |
|
496 return self._data[5] |
|
497 |
|
498 def metadata(self): |
|
499 """Decoded metadata dictionary""" |
|
500 return dict(self._data[3]) |
|
501 |
|
502 def date(self): |
|
503 """Creation date as (unixtime, offset)""" |
|
504 return self._data[4] |
|
505 |
|
506 def flags(self): |
|
507 """The flags field of the marker""" |
|
508 return self._data[2] |
|
509 |
|
510 @util.nogc |
468 @util.nogc |
511 def _addsuccessors(successors, markers): |
469 def _addsuccessors(successors, markers): |
512 for mark in markers: |
470 for mark in markers: |
513 successors.setdefault(mark[0], set()).add(mark) |
471 successors.setdefault(mark[0], set()).add(mark) |
514 |
472 |
849 rawmarkers = obsutil.exclusivemarkers(repo, nodes) |
807 rawmarkers = obsutil.exclusivemarkers(repo, nodes) |
850 else: |
808 else: |
851 rawmarkers = repo.obsstore.relevantmarkers(nodes) |
809 rawmarkers = repo.obsstore.relevantmarkers(nodes) |
852 |
810 |
853 for markerdata in rawmarkers: |
811 for markerdata in rawmarkers: |
854 yield marker(repo, markerdata) |
812 yield obsutil.marker(repo, markerdata) |
855 |
813 |
856 # keep compatibility for the 4.3 cycle |
814 # keep compatibility for the 4.3 cycle |
857 def allprecursors(obsstore, nodes, ignoreflags=0): |
815 def allprecursors(obsstore, nodes, ignoreflags=0): |
858 movemsg = 'obsolete.allprecursors moved to obsutil.allprecursors' |
816 movemsg = 'obsolete.allprecursors moved to obsutil.allprecursors' |
859 util.nouideprecwarn(movemsg, '4.3') |
817 util.nouideprecwarn(movemsg, '4.3') |
861 |
819 |
862 def allsuccessors(obsstore, nodes, ignoreflags=0): |
820 def allsuccessors(obsstore, nodes, ignoreflags=0): |
863 movemsg = 'obsolete.allsuccessors moved to obsutil.allsuccessors' |
821 movemsg = 'obsolete.allsuccessors moved to obsutil.allsuccessors' |
864 util.nouideprecwarn(movemsg, '4.3') |
822 util.nouideprecwarn(movemsg, '4.3') |
865 return obsutil.allsuccessors(obsstore, nodes, ignoreflags) |
823 return obsutil.allsuccessors(obsstore, nodes, ignoreflags) |
|
824 |
|
825 def marker(repo, data): |
|
826 movemsg = 'obsolete.marker moved to obsutil.marker' |
|
827 repo.ui.deprecwarn(movemsg, '4.3') |
|
828 return obsutil.marker(repo, data) |
866 |
829 |
867 def exclusivemarkers(repo, nodes): |
830 def exclusivemarkers(repo, nodes): |
868 movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers' |
831 movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers' |
869 repo.ui.deprecwarn(movemsg, '4.3') |
832 repo.ui.deprecwarn(movemsg, '4.3') |
870 return obsutil.exclusivemarkers(repo, nodes) |
833 return obsutil.exclusivemarkers(repo, nodes) |