更新本地版本或哈希变更集的Mercurial操作

4
我使用Mercurial,遇到了一个奇怪的问题。我有一个非常长的历史记录,现在Mercurial中本地修订版本只有5个字符。在Mercurial中,您可以执行“hg up”命令,并且它可以在本地修订版本和哈希更改集之间进行选择(我不知道它用于选择的策略),在我的情况下,本地修订版本与另一个哈希更改集的前5个字符相同。例如:
我想更新到本地修订版本:80145 如果我执行:
"hg up 80145"
Mercurial不会更新到我想要的版本,而是更新到旧版本,因为它的哈希更改集为:
801454d1cd5e 那么,有人知道是否有一种方法来指定要更新到哪种类型的修订版本?本地修订版本还是哈希更改集。
谢谢大家!
====
问题已解决。经过一些调查,我意识到Mercurial始终会更新到本地修订版本(如果存在),否则会更新到哈希更改集。在我的情况下,本地修订版本不存在,所以它正在更新到哈希更改集。
1个回答

2
听起来你已经找到了自己的答案(应该将其作为答案而不是评论输入,然后选择它——这不仅允许而且在这里是鼓励的),但是为了参考,这里是那些信息所在的位置:
$ hg help revisions
Specifying Single Revisions

Mercurial supports several ways to specify individual revisions.

A plain integer is treated as a revision number. Negative integers are
treated as sequential offsets from the tip, with -1 denoting the tip, -2
denoting the revision prior to the tip, and so forth.

A 40-digit hexadecimal string is treated as a unique revision identifier.

A hexadecimal string less than 40 characters long is treated as a unique
revision identifier and is referred to as a short-form identifier. A
short-form identifier is only valid if it is the prefix of exactly one
full-length identifier.

Any other string is treated as a bookmark, tag, or branch name. A bookmark
is a movable pointer to a revision. A tag is a permanent name associated
with a revision. A branch name denotes the tipmost revision of that
branch. Bookmark, tag, and branch names must not contain the ":"
character.

The reserved name "tip" always identifies the most recent revision.

The reserved name "null" indicates the null revision. This is the revision
of an empty repository, and the parent of revision 0.

The reserved name "." indicates the working directory parent. If no
working directory is checked out, it is equivalent to null. If an
uncommitted merge is in progress, "." is the revision of the first parent.

你发现第一个解释是关于修订号的,如果没有匹配到任何内容,就会尝试将其作为修订 ID 的前缀。理论上,即使只有编号为 0 的修订和它的哈希以数字 1 开头,这也可能发生。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接