Mercurial > hg
comparison mercurial/obsolete.py @ 33733:d5acd967f95a
obsstore: rename precursors into predecessors
Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
object.
The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.
Differential Revision: https://phab.mercurial-scm.org/D245
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 02 Aug 2017 19:39:08 +0200 |
parents | 32d4f815c4f4 |
children | 0c3112f17610 |
comparison
equal
deleted
inserted
replaced
33732:32d4f815c4f4 | 33733:d5acd967f95a |
---|---|
663 def successors(self): | 663 def successors(self): |
664 successors = {} | 664 successors = {} |
665 _addsuccessors(successors, self._all) | 665 _addsuccessors(successors, self._all) |
666 return successors | 666 return successors |
667 | 667 |
668 @property | |
669 def precursors(self): | |
670 msg = ("'obsstore.precursors' is deprecated, " | |
671 "use 'obsstore.predecessors'") | |
672 util.nouideprecwarn(msg, '4.4') | |
673 | |
674 return self.predecessors | |
675 | |
668 @propertycache | 676 @propertycache |
669 def precursors(self): | 677 def predecessors(self): |
670 predecessors = {} | 678 predecessors = {} |
671 _addpredecessors(predecessors, self._all) | 679 _addpredecessors(predecessors, self._all) |
672 return predecessors | 680 return predecessors |
673 | 681 |
674 @propertycache | 682 @propertycache |
684 markers = list(markers) # to allow repeated iteration | 692 markers = list(markers) # to allow repeated iteration |
685 self._data = self._data + rawdata | 693 self._data = self._data + rawdata |
686 self._all.extend(markers) | 694 self._all.extend(markers) |
687 if self._cached('successors'): | 695 if self._cached('successors'): |
688 _addsuccessors(self.successors, markers) | 696 _addsuccessors(self.successors, markers) |
689 if self._cached('precursors'): | 697 if self._cached('predecessors'): |
690 _addpredecessors(self.precursors, markers) | 698 _addpredecessors(self.predecessors, markers) |
691 if self._cached('children'): | 699 if self._cached('children'): |
692 _addchildren(self.children, markers) | 700 _addchildren(self.children, markers) |
693 _checkinvalidmarkers(markers) | 701 _checkinvalidmarkers(markers) |
694 | 702 |
695 def relevantmarkers(self, nodes): | 703 def relevantmarkers(self, nodes): |
704 It is a set so you cannot rely on order.""" | 712 It is a set so you cannot rely on order.""" |
705 | 713 |
706 pendingnodes = set(nodes) | 714 pendingnodes = set(nodes) |
707 seenmarkers = set() | 715 seenmarkers = set() |
708 seennodes = set(pendingnodes) | 716 seennodes = set(pendingnodes) |
709 precursorsmarkers = self.precursors | 717 precursorsmarkers = self.predecessors |
710 succsmarkers = self.successors | 718 succsmarkers = self.successors |
711 children = self.children | 719 children = self.children |
712 while pendingnodes: | 720 while pendingnodes: |
713 direct = set() | 721 direct = set() |
714 for current in pendingnodes: | 722 for current in pendingnodes: |
955 """ | 963 """ |
956 divergent = set() | 964 divergent = set() |
957 obsstore = repo.obsstore | 965 obsstore = repo.obsstore |
958 newermap = {} | 966 newermap = {} |
959 for ctx in repo.set('(not public()) - obsolete()'): | 967 for ctx in repo.set('(not public()) - obsolete()'): |
960 mark = obsstore.precursors.get(ctx.node(), ()) | 968 mark = obsstore.predecessors.get(ctx.node(), ()) |
961 toprocess = set(mark) | 969 toprocess = set(mark) |
962 seen = set() | 970 seen = set() |
963 while toprocess: | 971 while toprocess: |
964 prec = toprocess.pop()[0] | 972 prec = toprocess.pop()[0] |
965 if prec in seen: | 973 if prec in seen: |
969 obsutil.successorssets(repo, prec, cache=newermap) | 977 obsutil.successorssets(repo, prec, cache=newermap) |
970 newer = [n for n in newermap[prec] if n] | 978 newer = [n for n in newermap[prec] if n] |
971 if len(newer) > 1: | 979 if len(newer) > 1: |
972 divergent.add(ctx.rev()) | 980 divergent.add(ctx.rev()) |
973 break | 981 break |
974 toprocess.update(obsstore.precursors.get(prec, ())) | 982 toprocess.update(obsstore.predecessors.get(prec, ())) |
975 return divergent | 983 return divergent |
976 | 984 |
977 | 985 |
978 def createmarkers(repo, relations, flag=0, date=None, metadata=None, | 986 def createmarkers(repo, relations, flag=0, date=None, metadata=None, |
979 operation=None): | 987 operation=None): |