136 return False |
136 return False |
137 return ctx.rev() in ctx._repo._extinctset |
137 return ctx.rev() in ctx._repo._extinctset |
138 |
138 |
139 context.changectx.extinct = extinct |
139 context.changectx.extinct = extinct |
140 |
140 |
|
141 def latecomer(ctx): |
|
142 """is the changeset latecomer (Try to succeed to public change)""" |
|
143 if ctx.node() is None: |
|
144 return False |
|
145 return ctx.rev() in ctx._repo._latecomerset |
|
146 |
|
147 context.changectx.latecomer = latecomer |
|
148 |
141 |
149 |
142 ### revset |
150 ### revset |
143 ############################# |
151 ############################# |
144 |
152 |
145 |
153 |
168 def revsetextinct(repo, subset, x): |
176 def revsetextinct(repo, subset, x): |
169 """obsolete changesets without obsolete descendants""" |
177 """obsolete changesets without obsolete descendants""" |
170 args = revset.getargs(x, 0, 0, 'unstable takes no arguments') |
178 args = revset.getargs(x, 0, 0, 'unstable takes no arguments') |
171 return [r for r in subset if r in repo._extinctset] |
179 return [r for r in subset if r in repo._extinctset] |
172 |
180 |
|
181 def revsetlatecomer(repo, subset, x): |
|
182 """latecomer, Try to succeed to public change""" |
|
183 args = revset.getargs(x, 0, 0, 'unstable takes no arguments') |
|
184 return [r for r in subset if r in repo._latecomerset] |
173 |
185 |
174 def _precursors(repo, s): |
186 def _precursors(repo, s): |
175 """Precursor of a changeset""" |
187 """Precursor of a changeset""" |
176 cs = set() |
188 cs = set() |
177 nm = repo.changelog.nodemap |
189 nm = repo.changelog.nodemap |
365 |
377 |
366 revset.symbols["obsolete"] = revsetobsolete |
378 revset.symbols["obsolete"] = revsetobsolete |
367 revset.symbols["unstable"] = revsetunstable |
379 revset.symbols["unstable"] = revsetunstable |
368 revset.symbols["suspended"] = revsetsuspended |
380 revset.symbols["suspended"] = revsetsuspended |
369 revset.symbols["extinct"] = revsetextinct |
381 revset.symbols["extinct"] = revsetextinct |
|
382 revset.symbols["latecomer"] = revsetlatecomer |
370 revset.symbols["obsparents"] = revsetprecursors # DEPR |
383 revset.symbols["obsparents"] = revsetprecursors # DEPR |
371 revset.symbols["precursors"] = revsetprecursors |
384 revset.symbols["precursors"] = revsetprecursors |
372 revset.symbols["obsancestors"] = revsetallprecursors # DEPR |
385 revset.symbols["obsancestors"] = revsetallprecursors # DEPR |
373 revset.symbols["allprecursors"] = revsetallprecursors # bad name |
386 revset.symbols["allprecursors"] = revsetallprecursors # bad name |
374 revset.symbols["successors"] = revsetsuccessors |
387 revset.symbols["successors"] = revsetsuccessors |
507 elif ignore: |
520 elif ignore: |
508 return repo.branchmap() |
521 return repo.branchmap() |
509 else: |
522 else: |
510 return None # break recursion |
523 return None # break recursion |
511 |
524 |
|
525 def wrapclearcache(orig, repo, *args, **kwargs): |
|
526 try: |
|
527 return orig(repo, *args, **kwargs) |
|
528 finally: |
|
529 repo._clearobsoletecache() |
|
530 |
512 |
531 |
513 ### New commands |
532 ### New commands |
514 ############################# |
533 ############################# |
515 |
534 |
516 cmdtable = {} |
535 cmdtable = {} |
604 extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) |
623 extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) |
605 extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) |
624 extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) |
606 extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing) |
625 extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing) |
607 extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads) |
626 extensions.wrapfunction(discovery, 'checkheads', wrapcheckheads) |
608 extensions.wrapfunction(phases, 'visibleheads', noextinctsvisibleheads) |
627 extensions.wrapfunction(phases, 'visibleheads', noextinctsvisibleheads) |
|
628 extensions.wrapfunction(phases, 'advanceboundary', wrapclearcache) |
609 if util.safehasattr(phases, 'visiblebranchmap'): |
629 if util.safehasattr(phases, 'visiblebranchmap'): |
610 extensions.wrapfunction(phases, 'visiblebranchmap', wrapvisiblebranchmap) |
630 extensions.wrapfunction(phases, 'visiblebranchmap', wrapvisiblebranchmap) |
611 |
631 |
612 ### serialisation |
632 ### serialisation |
613 ############################# |
633 ############################# |
838 @util.propertycache |
858 @util.propertycache |
839 def _extinctset(self): |
859 def _extinctset(self): |
840 """the set of obsolete parent without non obsolete descendant""" |
860 """the set of obsolete parent without non obsolete descendant""" |
841 return set(self.revs('obsolete() - obsolete()::unstable()')) |
861 return set(self.revs('obsolete() - obsolete()::unstable()')) |
842 |
862 |
|
863 @util.propertycache |
|
864 def _latecomerset(self): |
|
865 """the set of rev trying to obsolete public revision""" |
|
866 return set(self.revs('allsuccessors(public()) - obsolete()')) |
|
867 |
843 def _clearobsoletecache(self): |
868 def _clearobsoletecache(self): |
844 if '_obsoleteset' in vars(self): |
869 if '_obsoleteset' in vars(self): |
845 del self._obsoleteset |
870 del self._obsoleteset |
846 self._clearunstablecache() |
871 self._clearunstablecache() |
847 |
872 |
854 del self._unstableset |
879 del self._unstableset |
855 if '_suspendedset' in vars(self): |
880 if '_suspendedset' in vars(self): |
856 del self._suspendedset |
881 del self._suspendedset |
857 if '_extinctset' in vars(self): |
882 if '_extinctset' in vars(self): |
858 del self._extinctset |
883 del self._extinctset |
|
884 if '_latecomerset' in vars(self): |
|
885 del self._latecomerset |
859 |
886 |
860 def addobsolete(self, sub, obj): |
887 def addobsolete(self, sub, obj): |
861 """Add a relation marking that node <sub> is a new version of <obj>""" |
888 """Add a relation marking that node <sub> is a new version of <obj>""" |
862 assert sub != obj |
889 assert sub != obj |
863 if not repo[obj].phase(): |
890 if not repo[obj].phase(): |