跳至主要内容

git-blame for stacktraces

项目描述

git-stacktrace

git-stacktrace是一个工具,帮助您将git提交与堆栈跟踪关联起来。

它通过查看以下内容帮助您识别相关提交:

  • 给定范围内的提交,这些提交修改了堆栈跟踪中存在的文件

  • 给定范围内的提交,这些提交添加/删除了堆栈跟踪中存在的代码

支持的语言

开发

使用:tox运行测试

安装

$ pip install git_stacktrace

用法

在git初始化的目录中运行git stacktrace

usage: git stacktrace [<options>] [<RANGE>] < stacktrace from stdin

Lookup commits related to a given stacktrace.

positional arguments:
  range                 git commit range to use

optional arguments:
  -h, --help            show this help message and exit
  --since <date1>       show commits more recent than a specific date (from
                        git-log)
  --server              start a webserver to visually interact with git-
                        stacktrace
  --port PORT           Server port
  -f, --fast            Speed things up by not running pickaxe if the file for
                        a line of code cannot be found
  -b [BRANCH], --branch [BRANCH]
                        Git branch. If using --since, use this to specify
                        which branch to run since on. Runs on current branch
                        by default
  --version             show program's version number and exit
  -d, --debug           Enable debug logging

有关Python API,请参阅:git_stacktrace/api.py

作为Web服务器运行:git stacktrace --server --port=8080GIT_STACKTRACE_PORT=8080 git stacktrace --server

将Web服务器用作API

$ curl \
  -d '{"option-type":"by-date", "since":"1.day", "trace":"..."}' \
  -H "Content-Type: application/json" \
  -X POST http://localhost:8080/

示例

示例输出

$ git stacktrace --since=1.day < trace
Traceback (most recent call last):
 File "webapp/framework/resource.py", line 72, in _call
   result = getattr(self, method_name)()
 File "webapp/resources/interests_resource.py", line 232, in get
   if self.options['from_navigate'] == "true":
KeyError


commit da39a3ee5e6b4b0d3255bfef95601890afd80709
Commit Date: Tue, 19 Jul 2016 14:18:08 -0700
Author:      John Doe <johndoe@pinterest.com>
Subject:     break interest resource
Link:        https://example.com/D1000
Files Modified:
   - webapp/resources/interests_resource.py:232
Lines Added:
   - "if self.options['from_navigate'] == "true":"

变更日志

1.0.0

0.9.0

0.8.1

  • 增加几个缺失的罕见git文件状态(T, U, X)

0.8.0

  • 修复python3的pickaxe支持

  • 改进Java traceback支持

  • 改进Python API

0.7.2

0.7.1

0.7.0

  • 增加python 3支持

0.6.0

  • 支持任意大小的缩写哈希值

  • 澄清CLI帮助信息

0.5.0

  • 匹配stacktrace中的文件行号与提交中更改的行

  • 区分添加、删除和修改的文件

  • 打印stacktrace的标题和页脚

  • 修复git pickaxe错误(使用‘–’分隔路径和修订版本)

  • 添加初始Java stacktrace支持。开始支持基本的Java stacktraces,尚未支持一些更复杂的格式。

0.4.1

  • 准备发布到pypi

0.4.0

  • 首次开源提交

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

git-stacktrace-1.0.0.tar.gz (34.8 kB 查看哈希值

上传时间

支持