git - 从 git format-patch 上传到 ReviewBoard 在 "file not found in the repository"上失败

标签 git review-board format-patch

有没有人看到投诉The file “<file>” (revision <revision>) was not found in the repository在使用 ReviewBoard GUI 时?

例如我得到 The file "agent/src/com/cloud/agent/resource/HypervResource.java" (revision 8b8e89d) was not found in the repository上传用 git format-patch 创建的差异文件时.

但是,该文件是我的 diff 的一部分,并且从未出现在我的补丁引用的 git 存储库中。

背景是我给master分支打了补丁。例如

$ git format-patch origin/master --stdout > ../hyperV-plugin.patch

补丁本身描述了文件的创建,应用索引 8b8e89d,如下所示。

1.7.9


From 13f9c118c724afb52b0694de539b4e1b3c38e7f7 Mon Sep 17 00:00:00 2001
From: "U-CC-SVR11\\Administrator" <Administrator@CC-SVR11.(none)>
Date: Thu, 15 Nov 2012 19:19:08 +0000
Subject: [PATCH 07/96] Starting point for ServerResource for Hyper-V is DummyResource.

---
.../com/cloud/agent/resource/HypervResource.java   |  227
++++++++++++++++++++
1 files changed, 227 insertions(+), 0 deletions(-) create mode 100755 agent/src/com/cloud/agent/resource/HypervResource.java

diff --git a/agent/src/com/cloud/agent/resource/HypervResource.java
b/agent/src/com/cloud/agent/resource/HypervResource.java
new file mode 100755
index 0000000..8b8e89d
--- /dev/null
+++ b/agent/src/com/cloud/agent/resource/HypervResource.java
@@ -0,0 +1,227 @@
+// Licensed to the Apache Software Foundation (ASF) under one // or 
+more contributor license agreements.  See the NOTICE file // 
+distributed with this work for additional information // regarding 
+copyright ownership.  The ASF licenses this file // to you under the 
+Apache License, Version 2.0 (the // "License"); you may not use this 
+file except in compliance // with the License.  You may obtain a copy 
+of the License at

稍后,文件索引在编辑文件时发生变化。例如

1.7.9


From fef4e3f291264224ed1430b3dff1e49bea7930c9 Mon Sep 17 00:00:00 2001
From: "U-CC-SVR11\\Administrator" <Administrator@CC-SVR11.(none)>
Date: Mon, 19 Nov 2012 15:41:26 +0000
Subject: [PATCH 09/96] Add min messages for host to register with the management server when it starts up.

---
.../com/cloud/agent/resource/HypervResource.java   |  200
++++++++++++++++++-
1 files changed, 189 insertions(+), 11 deletions(-)

diff --git a/agent/src/com/cloud/agent/resource/HypervResource.java
b/agent/src/com/cloud/agent/resource/HypervResource.java
index 8b8e89d..e810ce4 100755
--- a/agent/src/com/cloud/agent/resource/HypervResource.java
+++ b/agent/src/com/cloud/agent/resource/HypervResource.java
@@ -20,14 +20,15 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
+import java.util.Set;
import java.util.UUID;

最佳答案

在我有机会提交上述问题之前,我已经找到了答案。由于答案不明显,我将其发布在这里:

对于多提交补丁,通过“post-review”而不是 ReviewBoard GUI 创建。

问题在于添加一个聚合了一堆补丁的差异文件。就我而言,我有 ~97 次提交。为每个提交生成一个补丁 git format-patch -s master 给你 97 个不同的补丁来审查,这是难以管理的。 Apache 建议使用 git format-patch master --stdout > ~/patch-name.patch 将补丁转储到一个文件中(参见 Contributing to Apache CloudStack as a Non-Committer)不幸的是,当一个补丁依赖于另一个。

为避免这些问题,请通过 RBTools 中的 post-review 命令将提交作为单个补丁提交(审查委员会工具,请参阅 install instructions。安装 RBTools 后,验证您的本地 git repo 的origin/master 正在跟踪您的代码 merge 的目标。例如

$ git remote -v
origin  https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git (fetch)
origin  https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git (push)

此外,设置目标审查委员会。例如。要为 repo 设置,请在 repo 的根文件夹中使用以下命令。

git config reviewboard.url https://reviews.apache.org

从本地 git 存储库的根目录,只需调用 post-review。它将总结本地仓库中 HEAD 和 origin/master 之间的变化,创建评论,并返回 URL。然后,您可以使用浏览器充实评论/摘要/群组。

尽情享受吧!

关于git - 从 git format-patch 上传到 ReviewBoard 在 "file not found in the repository"上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14594051/

相关文章:

svn - 自动化 SVN 预先提交给审查委员会,然后在批准后提交给 SVN

git - 我怎样才能让 git am/git apply 像补丁命令一样工作 "fuzzy"

git - 如何 'git-am' 应用使用 'git-format-patch --no-prefix' 创建的补丁?

git - 重新打开 Gerrit 中接受的更改

git - (Reviewboard 1.7 RBTools 0.6) 如何对一系列提交进行后期审查

Xcode 4 : Update CFBundleVersion on each build using Git repo commit version

git - 评论板错误 : rbtools. 命令。CommandError:似乎没有任何差异

空提交上的 git format-patch 返回意外结果

Git推 pull 很头疼

git 忽略配置 core.sshcommand 但与 GIT_SSH_COMMAND= 一起工作正常