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.
hg-reviewers |
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.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | contrib/phabricator.py (4 lines) | |||
M | mercurial/obsolete.py (2 lines) | |||
M | mercurial/obsutil.py (11 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan |
import re | import re | ||||
from mercurial.node import bin, nullid | from mercurial.node import bin, nullid | ||||
from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
from mercurial import ( | from mercurial import ( | ||||
encoding, | encoding, | ||||
error, | error, | ||||
mdiff, | mdiff, | ||||
obsolete, | obsutil, | ||||
patch, | patch, | ||||
registrar, | registrar, | ||||
scmutil, | scmutil, | ||||
tags, | tags, | ||||
url as urlmod, | url as urlmod, | ||||
util, | util, | ||||
) | ) | ||||
unfi = repo.unfiltered() | unfi = repo.unfiltered() | ||||
nodemap = unfi.changelog.nodemap | nodemap = unfi.changelog.nodemap | ||||
result = {} # {node: (oldnode?, lastdiff?, drev)} | result = {} # {node: (oldnode?, lastdiff?, drev)} | ||||
toconfirm = {} # {node: (force, {precnode}, drev)} | toconfirm = {} # {node: (force, {precnode}, drev)} | ||||
for node in nodelist: | for node in nodelist: | ||||
ctx = unfi[node] | ctx = unfi[node] | ||||
# For tags like "D123", put them into "toconfirm" to verify later | # For tags like "D123", put them into "toconfirm" to verify later | ||||
precnodes = list(obsolete.allprecursors(unfi.obsstore, [node])) | precnodes = list(obsutil.allpredecessors(unfi.obsstore, [node])) | ||||
for n in precnodes: | for n in precnodes: | ||||
if n in nodemap: | if n in nodemap: | ||||
for tag in unfi.nodetags(n): | for tag in unfi.nodetags(n): | ||||
m = _differentialrevisiontagre.match(tag) | m = _differentialrevisiontagre.match(tag) | ||||
if m: | if m: | ||||
toconfirm[node] = (0, set(precnodes), int(m.group(1))) | toconfirm[node] = (0, set(precnodes), int(m.group(1))) | ||||
continue | continue | ||||
public = phases.public | public = phases.public | ||||
cl = repo.changelog | cl = repo.changelog | ||||
torev = cl.nodemap.get | torev = cl.nodemap.get | ||||
for ctx in repo.set('(not public()) and (not obsolete())'): | for ctx in repo.set('(not public()) and (not obsolete())'): | ||||
rev = ctx.rev() | rev = ctx.rev() | ||||
# We only evaluate mutable, non-obsolete revision | # We only evaluate mutable, non-obsolete revision | ||||
node = ctx.node() | node = ctx.node() | ||||
# (future) A cache of predecessors may worth if split is very common | # (future) A cache of predecessors may worth if split is very common | ||||
for pnode in obsutil.allprecursors(repo.obsstore, [node], | for pnode in obsutil.allpredecessors(repo.obsstore, [node], | ||||
ignoreflags=bumpedfix): | ignoreflags=bumpedfix): | ||||
prev = torev(pnode) # unfiltered! but so is phasecache | prev = torev(pnode) # unfiltered! but so is phasecache | ||||
if (prev is not None) and (phase(repo, prev) <= public): | if (prev is not None) and (phase(repo, prev) <= public): | ||||
# we have a public predecessor | # we have a public predecessor | ||||
bumped.add(rev) | bumped.add(rev) | ||||
break # Next draft! | break # Next draft! | ||||
return bumped | return bumped | ||||
continue | continue | ||||
seen.add(precnodeid) | seen.add(precnodeid) | ||||
if precnodeid in repo: | if precnodeid in repo: | ||||
yield precnodeid | yield precnodeid | ||||
else: | else: | ||||
stack.append(precnodeid) | stack.append(precnodeid) | ||||
def allprecursors(obsstore, nodes, ignoreflags=0): | def allprecursors(*args, **kwargs): | ||||
""" (DEPRECATED) | |||||
""" | |||||
msg = ("'obsutil.allprecursors' is deprecated, " | |||||
"use 'obsutil.allpredecessors'") | |||||
util.nouideprecwarn(msg, '4.4') | |||||
return allpredecessors(*args, **kwargs) | |||||
def allpredecessors(obsstore, nodes, ignoreflags=0): | |||||
"""Yield node for every precursors of <nodes>. | """Yield node for every precursors of <nodes>. | ||||
Some precursors may be unknown locally. | Some precursors may be unknown locally. | ||||
This is a linear yield unsuited to detecting folded changesets. It includes | This is a linear yield unsuited to detecting folded changesets. It includes | ||||
initial nodes too.""" | initial nodes too.""" | ||||
remaining = set(nodes) | remaining = set(nodes) |