使用 Mercurial,如果经常提交中间状态,如何与固定修订版进行差异化? [英] Using Mercurial, how to diff with a fixed revision if commit intermediate states often?

查看:52
本文介绍了使用 Mercurial,如果经常提交中间状态,如何与固定修订版进行差异化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Mercurial,假设我执行了 hg pullhg up,现在本地存储库和工作目录都是最新的.

Using Mercurial, say if I do an hg pull and hg up and now the local repo and working directory are both up to date.

如果我经常提交,比如 1 天后,然后是 2 天后,并且想要与现在的修订版有所不同怎么办?

What if I commit often, say 1 day later, and then 2 days later, and want to diff with the revision as of right now?

否则,差异总是与之前提交的版本进行比较.

Otherwise, the diff is always comparing to the previous committed version.

我现在可以用铅笔和纸写下修订号,比如说,4117,然后是 1 天后、2 天后,以及在我确定之前的任何时间并推送到远程中央仓库,做一个

I can use pencil and paper and write down the revision number right now, say, 4117, and then 1 day later, 2 days later, and any time before I am sure and push to the remote central repo, do an

hg vdiff -r 4117      

(使用 vdiffdiff).但不是记住这个神奇数字"4117,有没有办法让 Mercurial 以某种方式记住这个数字?这样,hg vdiff 是查看与提交代码的细微更改之间的差异,但有一个差异显示推送到远程存储库之前的所有更改.

(either using vdiff or diff). But instead of remembering this "magic number" 4117, is there a way to make Mercurial somehow remember this number? That way, hg vdiff is to see the difference between minor changes against committed code, but there is a diff that shows all changes before pushing to the remote repo.

(或者,如果有命令显示自上次拉取以来的修订号,它也应该显示 4117,因此在 bash 上我们可以执行类似 hg vdiff -r `hg--what-is-last-pull` )

(or, if there is command that shows the revision number since your last pull, which should also show 4117, so on bash we can do something like hg vdiff -r `hg --what-is-last-pull` )

更新: hg out --patch 是否显示推送到远程存储库的内容的差异?如果是这样,也许它可以在不关心幻数"的情况下达到目的.但是如何使用 kdiff3 或任何其他差异工具显示补丁差异?此外,似乎我们可以执行 hg out 并且如果我们看到 4118、4119、4120,那么我们知道如果我们执行 hg vdiff -r ___ 我们应该使用 (4118 -1) 即 4117.

Update: does hg out --patch show the diff of what would be pushed to the remote repo? If so, maybe it serves the purpose without caring the "magic number". But how to show the patch diff using kdiff3 or any other diff tools? Also, it seems we can do hg out and if we see 4118, 4119, 4120, then we know if we do hg vdiff -r ___ we should use (4118 - 1) which is 4117.

更新 2: 实际上,hg out --patch 显示了本地 repo 和远程 repo 之间的差异,因此它很接近,但与工作目录与本地或远程存储库之间的差异.

Update 2: actually, hg out --patch shows the diff between local repo and the remote repo, so it is close, but not exactly the same as the diff between working directory and the local or remote repo.

推荐答案

如果要标记修订,可以使用书签扩展.它与 mercurial 一起发货.文档可在此处

If you want to mark a revision you can use bookmarks extensions. It is shipped with mercurial. Documentationis available here

就你而言,

hg pull -u
hg bookmarks lastpull
..hack..hack..
hg ci -m new-hack
hg diff -r lastpull:tip
hg bookmarks -d lastpull

这篇关于使用 Mercurial,如果经常提交中间状态,如何与固定修订版进行差异化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆