【问题标题】:Mercurial, how to tag old version of filesMercurial,如何标记旧版本的文件
【发布时间】:2012-01-27 03:46:05
【问题描述】:

我忘记使用发布标签标记我的文件的旧版本。旧版本为 r13,最新版本约为 r65。我将最新的存储库克隆到一个新目录,执行“hg update -r13”以获取我想要标记的旧代码,然后执行标记命令,但得到消息:

abort:不在分支头(使用-f强制)

在这种情况下使用 -f 选项是否安全?

【问题讨论】:

    标签: mercurial tagging


    【解决方案1】:

    我猜你仍然可以在 repo 中直接进行标记,而无需将自己更新到特定版本。

    hg 标记 -r 13 标记名

    详情请见Mercurial wiki

    我试过测试它:

    temp $ hg init .
    temp $ touch a.txt
    temp $ hg add a.txt 
    temp $ hg commit -m "added a"
    temp $ hg status
    temp $ echo "sdwwdd" >> a.txt 
    temp $ hg commit -m "modified a"
    temp $ echo "\neddwedd" >> a.txt 
    temp $ hg commit -m "modified a again"
    temp $ hg log
    changeset:   2:ef40a402fdab
    tag:         tip
    user:        "xxxx"
    date:        Fri Dec 23 16:51:48 2011 -0800
    summary:     modified a again
    
    changeset:   1:d630dc3e2e3a
    user:        "xxxx"
    date:        Fri Dec 23 16:51:31 2011 -0800
    summary:     modified a
    
    changeset:   0:7c9917f24515
    user:        "xxxx"
    date:        Fri Dec 23 16:51:04 2011 -0800
    summary:     added a
    

    输出:

    temp $ hg tag -r 1 a.txt a_1
    temp $ hg tags
    tip                                3:e3157256098f
    a_1                                1:d630dc3e2e3a
    a.txt                              1:d630dc3e2e3a
    temp $ hg tag -r 1 all_1
    temp $ hg tags
    tip                                4:a643971911d8
    all_1                              1:d630dc3e2e3a
    a_1                                1:d630dc3e2e3a
    a.txt                              1:d630dc3e2e3a
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-25
      • 1970-01-01
      • 2011-05-12
      • 2011-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多