Mercurial > public > mercurial-scm > hg
comparison mercurial/obsolete.py @ 35891:75d9dcb64e7d
obsolete: drop deprecated methods (API)
.. api::
The following deprecated methods have been removed from obsolete, with
replacements:
- _addprecursors() -> _addpredecessors()
- obsstore.precursors -> obsstore.predecessors
- allprecursors() -> obsutil.allprecursors()
- allsuccessors() -> obsutil.allsuccessors()
- marker() -> obsutil.marker
- getmarkers() -> obsutil.getmarkers()
- exclusivemarkers() -> obsutil.exclusivemarkers()
- foreground() -> obsutil.foreground()
- successorssets() -> obsutil.successorsset()
- unstable() -> orphan()
- bumped() -> phasedivergent()
- divergent() -> contentdivergent()
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 02 Feb 2018 23:45:31 -0500 |
parents | d8f891ec5d7d |
children | 2831d918e1b4 |
comparison
equal
deleted
inserted
replaced
35890:44bc37d20271 | 35891:75d9dcb64e7d |
---|---|
504 @util.nogc | 504 @util.nogc |
505 def _addsuccessors(successors, markers): | 505 def _addsuccessors(successors, markers): |
506 for mark in markers: | 506 for mark in markers: |
507 successors.setdefault(mark[0], set()).add(mark) | 507 successors.setdefault(mark[0], set()).add(mark) |
508 | 508 |
509 def _addprecursors(*args, **kwargs): | |
510 msg = ("'obsolete._addprecursors' is deprecated, " | |
511 "use 'obsolete._addpredecessors'") | |
512 util.nouideprecwarn(msg, '4.4') | |
513 | |
514 return _addpredecessors(*args, **kwargs) | |
515 | |
516 @util.nogc | 509 @util.nogc |
517 def _addpredecessors(predecessors, markers): | 510 def _addpredecessors(predecessors, markers): |
518 for mark in markers: | 511 for mark in markers: |
519 for suc in mark[1]: | 512 for suc in mark[1]: |
520 predecessors.setdefault(suc, set()).add(mark) | 513 predecessors.setdefault(suc, set()).add(mark) |
698 def successors(self): | 691 def successors(self): |
699 successors = {} | 692 successors = {} |
700 _addsuccessors(successors, self._all) | 693 _addsuccessors(successors, self._all) |
701 return successors | 694 return successors |
702 | 695 |
703 @property | |
704 def precursors(self): | |
705 msg = ("'obsstore.precursors' is deprecated, " | |
706 "use 'obsstore.predecessors'") | |
707 util.nouideprecwarn(msg, '4.4') | |
708 | |
709 return self.predecessors | |
710 | |
711 @propertycache | 696 @propertycache |
712 def predecessors(self): | 697 def predecessors(self): |
713 predecessors = {} | 698 predecessors = {} |
714 _addpredecessors(predecessors, self._all) | 699 _addpredecessors(predecessors, self._all) |
715 return predecessors | 700 return predecessors |
841 with repo.lock(), repo.transaction('pushkey: obsolete markers') as tr: | 826 with repo.lock(), repo.transaction('pushkey: obsolete markers') as tr: |
842 repo.obsstore.mergemarkers(tr, data) | 827 repo.obsstore.mergemarkers(tr, data) |
843 repo.invalidatevolatilesets() | 828 repo.invalidatevolatilesets() |
844 return True | 829 return True |
845 | 830 |
846 # keep compatibility for the 4.3 cycle | |
847 def allprecursors(obsstore, nodes, ignoreflags=0): | |
848 movemsg = 'obsolete.allprecursors moved to obsutil.allprecursors' | |
849 util.nouideprecwarn(movemsg, '4.3') | |
850 return obsutil.allprecursors(obsstore, nodes, ignoreflags) | |
851 | |
852 def allsuccessors(obsstore, nodes, ignoreflags=0): | |
853 movemsg = 'obsolete.allsuccessors moved to obsutil.allsuccessors' | |
854 util.nouideprecwarn(movemsg, '4.3') | |
855 return obsutil.allsuccessors(obsstore, nodes, ignoreflags) | |
856 | |
857 def marker(repo, data): | |
858 movemsg = 'obsolete.marker moved to obsutil.marker' | |
859 repo.ui.deprecwarn(movemsg, '4.3') | |
860 return obsutil.marker(repo, data) | |
861 | |
862 def getmarkers(repo, nodes=None, exclusive=False): | |
863 movemsg = 'obsolete.getmarkers moved to obsutil.getmarkers' | |
864 repo.ui.deprecwarn(movemsg, '4.3') | |
865 return obsutil.getmarkers(repo, nodes=nodes, exclusive=exclusive) | |
866 | |
867 def exclusivemarkers(repo, nodes): | |
868 movemsg = 'obsolete.exclusivemarkers moved to obsutil.exclusivemarkers' | |
869 repo.ui.deprecwarn(movemsg, '4.3') | |
870 return obsutil.exclusivemarkers(repo, nodes) | |
871 | |
872 def foreground(repo, nodes): | |
873 movemsg = 'obsolete.foreground moved to obsutil.foreground' | |
874 repo.ui.deprecwarn(movemsg, '4.3') | |
875 return obsutil.foreground(repo, nodes) | |
876 | |
877 def successorssets(repo, initialnode, cache=None): | |
878 movemsg = 'obsolete.successorssets moved to obsutil.successorssets' | |
879 repo.ui.deprecwarn(movemsg, '4.3') | |
880 return obsutil.successorssets(repo, initialnode, cache=cache) | |
881 | |
882 # mapping of 'set-name' -> <function to compute this set> | 831 # mapping of 'set-name' -> <function to compute this set> |
883 cachefuncs = {} | 832 cachefuncs = {} |
884 def cachefor(name): | 833 def cachefor(name): |
885 """Decorator to register a function as computing the cache for a set""" | 834 """Decorator to register a function as computing the cache for a set""" |
886 def decorator(func): | 835 def decorator(func): |
930 getnode = repo.changelog.node | 879 getnode = repo.changelog.node |
931 notpublic = _mutablerevs(repo) | 880 notpublic = _mutablerevs(repo) |
932 isobs = repo.obsstore.successors.__contains__ | 881 isobs = repo.obsstore.successors.__contains__ |
933 obs = set(r for r in notpublic if isobs(getnode(r))) | 882 obs = set(r for r in notpublic if isobs(getnode(r))) |
934 return obs | 883 return obs |
935 | |
936 @cachefor('unstable') | |
937 def _computeunstableset(repo): | |
938 msg = ("'unstable' volatile set is deprecated, " | |
939 "use 'orphan'") | |
940 repo.ui.deprecwarn(msg, '4.4') | |
941 | |
942 return _computeorphanset(repo) | |
943 | 884 |
944 @cachefor('orphan') | 885 @cachefor('orphan') |
945 def _computeorphanset(repo): | 886 def _computeorphanset(repo): |
946 """the set of non obsolete revisions with obsolete parents""" | 887 """the set of non obsolete revisions with obsolete parents""" |
947 pfunc = repo.changelog.parentrevs | 888 pfunc = repo.changelog.parentrevs |
966 | 907 |
967 @cachefor('extinct') | 908 @cachefor('extinct') |
968 def _computeextinctset(repo): | 909 def _computeextinctset(repo): |
969 """the set of obsolete parents without non obsolete descendants""" | 910 """the set of obsolete parents without non obsolete descendants""" |
970 return getrevs(repo, 'obsolete') - getrevs(repo, 'suspended') | 911 return getrevs(repo, 'obsolete') - getrevs(repo, 'suspended') |
971 | |
972 @cachefor('bumped') | |
973 def _computebumpedset(repo): | |
974 msg = ("'bumped' volatile set is deprecated, " | |
975 "use 'phasedivergent'") | |
976 repo.ui.deprecwarn(msg, '4.4') | |
977 | |
978 return _computephasedivergentset(repo) | |
979 | 912 |
980 @cachefor('phasedivergent') | 913 @cachefor('phasedivergent') |
981 def _computephasedivergentset(repo): | 914 def _computephasedivergentset(repo): |
982 """the set of revs trying to obsolete public revisions""" | 915 """the set of revs trying to obsolete public revisions""" |
983 bumped = set() | 916 bumped = set() |
997 if (prev is not None) and (phase(repo, prev) <= public): | 930 if (prev is not None) and (phase(repo, prev) <= public): |
998 # we have a public predecessor | 931 # we have a public predecessor |
999 bumped.add(rev) | 932 bumped.add(rev) |
1000 break # Next draft! | 933 break # Next draft! |
1001 return bumped | 934 return bumped |
1002 | |
1003 @cachefor('divergent') | |
1004 def _computedivergentset(repo): | |
1005 msg = ("'divergent' volatile set is deprecated, " | |
1006 "use 'contentdivergent'") | |
1007 repo.ui.deprecwarn(msg, '4.4') | |
1008 | |
1009 return _computecontentdivergentset(repo) | |
1010 | 935 |
1011 @cachefor('contentdivergent') | 936 @cachefor('contentdivergent') |
1012 def _computecontentdivergentset(repo): | 937 def _computecontentdivergentset(repo): |
1013 """the set of rev that compete to be the final successors of some revision. | 938 """the set of rev that compete to be the final successors of some revision. |
1014 """ | 939 """ |