【问题标题】:Mercurial update to local revision or hash changesetMercurial 更新到本地修订或哈希变更集
【发布时间】:2012-09-14 11:01:54
【问题描述】:

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

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

"hg 向上 80145"

Mercurial 不会更新到我想要的版本,它会更新到旧版本,因为它的哈希变更集是:

801454d1cd5e

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

谢谢大家!

====

问题解决了。经过一番调查,我意识到 Mercurial 总是更新到本地版本(如果存在),否则更新到哈希变更集。 在我的情况下,本地版本不存在,所以它正在更新到哈希变更集

【问题讨论】:

    标签: mercurial dvcs


    【解决方案1】:

    听起来您找到了自己的答案(并且应该将其作为答案而不是评论输入,然后选择它——这不仅是允许的,而且是鼓励的),但作为参考,这里是该信息所在的位置:

    $ 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 开头,那么即使是数字1 也可能发生这种情况。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多