mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
smartlog: avoid false positive detection of revnum usage
Summary: If `smartlog()` is the user input, the revnum detection is enabled for the whole scope of smartlog revset implemenation. The use of rev numbers triggers the warning. But the user didn't use any rev number. Change smartlog to disable the revnum detection for its internal calculation. Carefully choose the scope so `smartlog(1+2)` will still be warned. Reviewed By: singhsrb Differential Revision: D16954997 fbshipit-source-id: 1a3d32c1c2bcba08bfac908623b6416cf1cd63a8
This commit is contained in:
parent
88ba91d3dc
commit
17f66b3e1f
@ -448,7 +448,6 @@ def smartlogrevset(repo, subset, x):
|
||||
'master' is the head of the public branch.
|
||||
(default: 'interestingmaster()')
|
||||
"""
|
||||
|
||||
args = revset.getargsdict(x, "smartlogrevset", "heads master")
|
||||
if "master" in args:
|
||||
masterset = revset.getset(repo, subset, args["master"])
|
||||
@ -464,10 +463,14 @@ def smartlogrevset(repo, subset, x):
|
||||
masterset -= smartset.baseset([nodemod.nullrev])
|
||||
if nodemod.nullrev in heads:
|
||||
heads.remove(nodemod.nullrev)
|
||||
# Select ancestors that are draft.
|
||||
drafts = repo.revs("draft() & ::%ld", heads)
|
||||
# Include parents of drafts, and public heads.
|
||||
revs = repo.revs("parents(%ld) + %ld + %ld + %ld", drafts, drafts, heads, masterset)
|
||||
# Explicitly disable revnum deprecation warnings.
|
||||
with repo.ui.configoverride({("devel", "legacy.revnum:real"): ""}):
|
||||
# Select ancestors that are draft.
|
||||
drafts = repo.revs("draft() & ::%ld", heads)
|
||||
# Include parents of drafts, and public heads.
|
||||
revs = repo.revs(
|
||||
"parents(%ld) + %ld + %ld + %ld", drafts, drafts, heads, masterset
|
||||
)
|
||||
|
||||
# Include the ancestor of above commits to make the graph connected.
|
||||
#
|
||||
|
@ -72,3 +72,11 @@ sh % "setconfig 'devel.legacy.revnum=abort'"
|
||||
sh % "hg up 0" == r"""
|
||||
abort: local revision number is disabled in this repo
|
||||
[255]"""
|
||||
|
||||
# smartlog revset
|
||||
|
||||
sh % "enable smartlog"
|
||||
sh % "hg log -r 'smartlog()' -T." == "..."
|
||||
sh % "hg log -r 'smartlog(1)' -T." == r"""
|
||||
abort: local revision number is disabled in this repo
|
||||
[255]"""
|
||||
|
Loading…
Reference in New Issue
Block a user