【问题标题】:should i use -f with "hg qimport"我应该将 -f 与“hg qimport”一起使用吗
【发布时间】:2010-11-05 06:03:41
【问题描述】:

我有一个使用 Mercurial 队列的 mercurial 存储库。假设以下场景。我创建了一个补丁firstpatch,然后弹出它。

我对代码库进行了一些更改,并创建了第二个补丁secondpatch。但是,当我再次尝试申请firstpatch 时,我没有成功。

$ hg qimport .hg/patches/firstpatch
abort: patch "firstpatch" already exists

然后我尝试使用 -f 标志,在这种情况下

$ hg qimport -f .hg/patches/firstpatch
adding firstpatch to series file

但是,补丁不会显示在hg log 命令的输出中。有点不对劲;我做错了什么?

【问题讨论】:

    标签: mercurial patch


    【解决方案1】:

    hg qimport 导入补丁队列中尚不存在的补丁。你想要的是 hg qpush 重新应用你之前 qpop 编辑的补丁。

    示例:

    C:\db> hg init
    C:\db> echo >file1
    C:\db> hg ci -Am codebase         # original codebase <contains file1>
    adding file1
    C:\db> echo >file2
    C:\db> hg add
    adding file2
    C:\db> hg qnew firstpatch         # firstpatch <contains file2>
    C:\db> hg qpop                    # remove firstpatch
    popping firstpatch
    patch queue now empty
    C:\db> echo >file3
    C:\db> hg add
    adding file3
    C:\db> hg qnew secondpatch        # secondpatch <contains file3>
    C:\db> hg qpush                   # reapply firstpatch
    applying firstpatch
    now at: firstpatch
    C:\db> hg manifest                # all files present
    file1
    file2
    file3
    

    请注意,Mercurial 队列作为堆栈进行管理。创建和删除 firstpatch 允许将 secondpatch 插入队列中它之前。 qpush 然后重新应用堆栈中的下一个补丁 (firstpatch)。使用hg qseries 查看整个补丁列表,使用hg qapplied 仅查看应用的补丁。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-13
      • 1970-01-01
      • 1970-01-01
      • 2011-06-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多