我已经使用 git 一段时间了,因为它是我唯一使用过的 DVCS,所以我学会了非常依赖它在我的工作流程中的工作方式。
我现在在一家新公司工作,他们使用 Mercurial,所以我需要了解 Mercurial 的模型以及它与 git 的不同之处,以适应我的工作流程并避免犯下代价高昂的错误。
那么我可以使用哪些资源呢?
最佳答案
相当延伸 concept differences from Mercurial's official wiki .
来自 stackoverflow 的另一个问题:Git equivalents of most common Mercurial commands?
评论跟进:
如果我继续:“模型”、“差异”、“差异背后的哲学”以及对“工作流程”的影响。在我能想到的差异中,有:
.git/objects
下的小文件。目录。我不会走得更远,我的理解到此为止,因为我从来没有发现知道比特是如何铺设的。您可以在对象的内容中进行 pretty-print :git show -s --format=raw <commitid> # changeset content
git ls-tree <treeid> # list tree content
git show <fileid> # blob content
.hg/store/data
下的文件名(revlogNG)。请注意,特殊字符和大写字符是“tilda-underscore 编码”。您可以列出文件的修订版本:
hg debugindex .hg/store/data/<file>.i # hg debugindex <file> also works but you see less of internals
您已经注意到
nodeid
s 不是 hg log
中的那个.现在,检查内容:
hg debugdata .hg/store/data/<file>.i <nodeid>
修订历史(或多或少你看到的
hg log
)存储在 .hg/store/00changelog.i
中。 (使用 hg debugindex .hg/store/00changelog.i
检查它,您将在 hg log
列中看到与 nodeid
中的 ID 相同的 ID)。显示一个 ID 为 XXXX
的原始历史条目, 类型 hg debugdata .hg/store/00changelog.i XXXX
在一个终端。 (看第一行,后面会用到 YYYY
)树的状态存储在
.hg/store/00manifest.i
.对应的nodeid
list 中是 YYYY
.hg debugdata .hg/store/00manifest.i YYYY
这将显示附加的“文件名+节点ID”列表。让我们选择文件
foo/bar
并注意 nodeid
附加到它并认为它是 ZZZZ
(行 foo/barZZZZ
)。最后一步,访问
foo/bar
的内容文件:hg debugdata .hg/store/data/foo/bar.i ZZZZ
blobid
可以与 treeid
碰撞(或 commitid
或 tagid
)但这是极不可能的。在 Mercurial 中,一个 changesetid
只能与另一个碰撞 changesetid
( list (树)和文件(blob)也是如此),这更不可能。 关于git - 作为一个有经验的 git 用户,我怎样才能学会理解 Mercurial 的工作原理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7331849/