为什么此修补程序无法移动文件?

时间:2019-04-15 18:01:50

标签: patch tortoisehg

我已经使用TortoiseHG导出了将文件移动到另一个位置的补丁。这是补丁的内容:

# HG changeset patch
# User Arthur Attout <arthur.attout@outlook.com>
# Date 1551095974 -3600
#      Mon Feb 25 12:59:34 2019 +0100
# Branch CBLS
# Node ID f73e7c88dbcf6de3091e1edc9360336d1c699038
# Parent  863386a2a66de9cdd6d8885912988cb4b862eef0
Unit tests + migrate unit tests int -> long


diff -r 863386a2a66d -r f73e7c88dbcf oscar-cbls/src/test/scala/oscar/cbls/test/invariants/InvariantTests.scala
--- a/oscar-cbls/src/test/scala/oscar/cbls/test/invariants/InvariantTests.scala Fri Feb 22 14:30:14 2019 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,948 +0,0 @@
-package oscar.cbls.test.invariants
-
- Thousands of lines ... 
-

diff -r 863386a2a66d -r f73e7c88dbcf oscar-cbls/src/test/scala/oscar/cbls/test/unit/InvariantTests.scala
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/oscar-cbls/src/test/scala/oscar/cbls/test/unit/InvariantTests.scala   Mon Feb 25 12:59:34 2019 +0100
@@ -0,0 +1,877 @@
+package oscar.cbls.test.unit
+ Same thousands of lines ... 
+

这是补丁所做的唯一事情。它将文件InvariantTestsinvariants移到unit

当我将补丁导入tortoiseHG时,出现以下错误

Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file oscar-cbls/src/test/scala/oscar/cbls/test/invariants/InvariantTests.scala.rej
patching file oscar-cbls/src/test/scala/oscar/cbls/test/unit/InvariantTests.scala
adding oscar-cbls/src/test/scala/oscar/cbls/test/unit/InvariantTests.scala
abandon : patch failed to apply
[command returned code 255 Mon Apr 15 19:55:02 2019]

之后,这是我的工作目录的内容

enter image description here

文件未移动。

这255个错误是什么意思?为什么补丁程序不只是简单地适当地移动文件?

1 个答案:

答案 0 :(得分:0)

Mercurial doc明确指出:

  

Mercurial的默认格式,用于显示两个版本之间的更改   文件与GNU diff的统一格式兼容,可以是   由GNU补丁和许多其他标准工具使用。

     

尽管这种标准格式通常就足够了,但它不对以下信息进行编码:

     
      
  • 可执行状态和其他权限位
  •   
  • 复制或重命名信息
  •   
  • 更改二进制文件的创建或删除空文件
  •   

要在补丁中包含此数据,必须使用-git(AFAICR)选项创建git兼容补丁,该选项也可在THG GUI中使用