【问题标题】:Why is this mercurial patch not moving the file?为什么这个 mercurial 补丁不移动文件?
【发布时间】:2019-04-15 18:01:49
【问题描述】:

我已经使用 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]

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

文件未移动。

这个 255 错误是什么意思?为什么补丁不能简单地应用正确移动文件?

【问题讨论】:

    标签: patch tortoisehg


    【解决方案1】:

    Mercurial doc 明确指出:

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

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

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

    为了在补丁中包含这些数据,您必须使用 -git (AFAICR) 选项创建与 git 兼容的补丁,该选项也可在 THG GUI 中使用

    【讨论】:

    • 嗯,奇怪的是这个补丁是由 tortoiseHG 工作台创建的(导出>导出补丁)。我也在 tortoiseHG 工作台中导入它。
    猜你喜欢
    • 2014-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多