Mercurial 变更集的列表大小?

发布于 2024-11-14 07:19:03 字数 52 浏览 3 评论 0 原文

寻求量化每个变更集中发生了多少变更。有什么快速方法可以列出两个修订版之间的 kb 差异吗?

Looking to quantify how much change happened in each changeset. Any quick way to list maybe kb diff between two revisions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

ゃ人海孤独症 2024-11-21 07:19:03

昨天我和@shambulator有同样的想法!因此,我添加了打印 增量大小(以字节为单位) 的功能我的 --diffstat 输出href="https://github.com/techtonik/python-patch/blob/master/patch.py​​" rel="nofollow noreferrer">有点长且干净的 patch.py​​ 实用程序。

wget https://raw.githubusercontent.com/techtonik/python-patch/master/patch.py
hg diff -c tip | python patch.py --diffstat --
 codereview/views.py | 28 ++++++++++++++++++++++++++++
 index.yaml          | 10 ++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-), +1267 bytes

UPD:感谢 @Gili 和 @mforbes,现在有一张 Mercurial 的门票
https://bz.mercurial-scm.org/show_bug.cgi?id= 4245

I had the same thought as @shambulator yesterday! So I've added ability to print delta size in bytes as a part of --diffstat output from my somewhat long and clean patch.py utility.

wget https://raw.githubusercontent.com/techtonik/python-patch/master/patch.py
hg diff -c tip | python patch.py --diffstat --
 codereview/views.py | 28 ++++++++++++++++++++++++++++
 index.yaml          | 10 ++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-), +1267 bytes

UPD: Thanks to @Gili and @mforbes there is now a ticket for Mercurial
https://bz.mercurial-scm.org/show_bug.cgi?id=4245

清旖 2024-11-21 07:19:03

也许可以使用 hg bundle 来检查尺寸? (我还没有检查这与存储库总大小的一致性。)

function revsize() {
  hg bundle -r $1 --base "p1($1)+p2($1)" /dev/stdout | wc -c
}

它是如何工作的

这使用 wc -c 生成修订版之间的更改的捆绑包后 REV = $1(bash 函数的第一个参数)和其父级 "p1(REV)+p2( REV)"(如果是合并,则可能有两个。)通过使用 /dev/stdout 作为文件,结果将发送到标准输出,并可通过管道传输到 <代码>厕所-c 不在磁盘上创建文件。

Perhaps one can use hg bundle to check the size? (I have not checked how consistent this is in terms of the total repository size.)

function revsize() {
  hg bundle -r $1 --base "p1($1)+p2($1)" /dev/stdout | wc -c
}

How it works

This computes the size (in bytes) using wc -c after generating a bundle for the changes between revision REV = $1 (the first argument to the bash function) and its parents "p1(REV)+p2(REV)" (there may be two if it is a merge.) By using /dev/stdout as a file, the result is sent to standard out where it can be piped to wc -c without creating a file on disk.

无边思念无边月 2024-11-21 07:19:03

hg log --stat 是您要执行的命令。看这个例子:

$ hg log --stat

changeset:   12431:56e146c7beef
user:        flast
date:        Wed Jun 08 16:12:54 2011 +1000
summary:     Fix the frobulate to frob the knob correctly on tuesdays.

 path/to/src/frob/interface.py       |  29 ++++++++++++++++++++---------
 path/to/tests/systest_frob.py       |  14 ++++++++++++++
 2 files changed, 34 insertions(+), 9 deletions(-)

hg log --stat is the command you're after. See this example:

$ hg log --stat

changeset:   12431:56e146c7beef
user:        flast
date:        Wed Jun 08 16:12:54 2011 +1000
summary:     Fix the frobulate to frob the knob correctly on tuesdays.

 path/to/src/frob/interface.py       |  29 ++++++++++++++++++++---------
 path/to/tests/systest_frob.py       |  14 ++++++++++++++
 2 files changed, 34 insertions(+), 9 deletions(-)
香草可樂 2024-11-21 07:19:03

昨天我也有同样的想法!我编写了一个快速而肮脏的Python脚本,用于确定给定标准输入上的统一差异或作为文件上的总文件大小变化命令行。要对变更集执行此操作,您可以:

hg diff -c <cset id> | patchsize.py

快速而肮脏,因为它可能不考虑特定于平台的行结尾,并且它不会特别巧妙地解析差异。但对于我的目的来说已经足够接近了。

I had the same thought only yesterday! I wrote a quick and dirty Python script for determining total file size change given a unified diff on stdin or as files on the command line. To do it for a changeset, you could just:

hg diff -c <cset id> | patchsize.py

Quick and dirty in the sense that it probably doesn't account for platform-specific line endings, and it doesn't parse diffs particularly cleverly. But it's close enough for my purposes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文