mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
templatekw: parents template should not return null p2
Summary: The `parents` template currently returns "meaningfulparents". This sometimes returns the null revision as the second parent, making templates think this is a merge commit when it is not. Make sure we filter this out. Reviewed By: quark-zju Differential Revision: D21347776 fbshipit-source-id: af83fd5cff381850ac39d97b5b2f4c77033fe2fb
This commit is contained in:
parent
fafe8802b4
commit
ed49d36d41
@ -604,13 +604,13 @@ def meaningfulparents(repo, ctx):
|
||||
is not the preceding revision.
|
||||
"""
|
||||
parents = ctx.parents()
|
||||
if len(parents) > 1:
|
||||
if len(parents) > 1 and parents[1].rev() != -1:
|
||||
return parents
|
||||
if repo.ui.debugflag:
|
||||
return [parents[0], repo["null"]]
|
||||
if parents[0].rev() >= intrev(ctx) - 1:
|
||||
return []
|
||||
return parents
|
||||
return parents[:1]
|
||||
|
||||
|
||||
def expandpats(pats):
|
||||
|
@ -914,9 +914,9 @@ def showp2node(repo, ctx, templ, **args):
|
||||
|
||||
@templatekeyword("parents")
|
||||
def showparents(**args):
|
||||
"""List of strings. The parents of the changeset in "rev:node"
|
||||
format. If the changeset has only one "natural" parent (the predecessor
|
||||
revision) nothing is shown."""
|
||||
"""List of strings. The parents of the changeset in "rev:node" format.
|
||||
If the changeset's only parent has the previous revision number, it is
|
||||
omitted."""
|
||||
args = args
|
||||
repo = args["repo"]
|
||||
ctx = args["ctx"]
|
||||
|
Loading…
Reference in New Issue
Block a user