Mercurial更新到本地修订版或散列更改集

时间:2012-09-14 11:01:55

标签: mercurial dvcs

我使用Mercurial,我有一个奇怪的问题,我有一个非常大的历史,Mercurial的本地修订现在有5个字符。 在Mercurial中,您可以执行“hg up”,它可以在本地修订版或散列更改集之间进行选择(我不知道它用于在彼此之间进行选择的策略),在我的情况下,本地修订版与5个第一个字符一致另一个哈希变更集。例如:

我想更新到本地版本:80145 如果我执行:

“hg up 80145”

Mercurial没有更新到我想要的修订版本,它更新为旧版本,因为它的哈希值更改集是:

801454d1cd5e

那么,是否有人知道是否有办法指定要更新到哪种类型的修订版?本地修订或哈希变更集。

全部谢谢!

====

问题解决了。经过一些调查后,我意识到Mercurial总是更新到本地修订版(如果存在),否则更新为散列更改集。 在我的情况下,本地修订版本不存在,因此它正在更新为哈希变更集

1 个答案:

答案 0 :(得分: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的前缀。理论上,如果您的唯一更改集是修订版1并且其哈希值以0开头,则即使数字1也可能发生这种情况。