base.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:gardenbot 作者: GoestaO 项目源码 文件源码
def _catch_revision_errors(
            self,
            ancestor=None, multiple_heads=None, start=None, end=None,
            resolution=None):
        try:
            yield
        except revision.RangeNotAncestorError as rna:
            if start is None:
                start = rna.lower
            if end is None:
                end = rna.upper
            if not ancestor:
                ancestor = (
                    "Requested range %(start)s:%(end)s does not refer to "
                    "ancestor/descendant revisions along the same branch"
                )
            ancestor = ancestor % {"start": start, "end": end}
            compat.raise_from_cause(util.CommandError(ancestor))
        except revision.MultipleHeads as mh:
            if not multiple_heads:
                multiple_heads = (
                    "Multiple head revisions are present for given "
                    "argument '%(head_arg)s'; please "
                    "specify a specific target revision, "
                    "'<branchname>@%(head_arg)s' to "
                    "narrow to a specific head, or 'heads' for all heads")
            multiple_heads = multiple_heads % {
                "head_arg": end or mh.argument,
                "heads": util.format_as_comma(mh.heads)
            }
            compat.raise_from_cause(util.CommandError(multiple_heads))
        except revision.ResolutionError as re:
            if resolution is None:
                resolution = "Can't locate revision identified by '%s'" % (
                    re.argument
                )
            compat.raise_from_cause(util.CommandError(resolution))
        except revision.RevisionError as err:
            compat.raise_from_cause(util.CommandError(err.args[0]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号