Perforce:基于 Linux 的三向合并/解析工具?

发布于 2024-10-21 16:22:16 字数 1539 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

紫﹏色ふ单纯 2024-10-28 16:22:16

我更喜欢 meld 它功能强大但轻量级,并且不像 Kdiff3 那样没有 KDE 依赖。
看看官方主页

I prefer meld It is powerful yet lightweight and has no KDE deps as Kdiff3 does.
Look at official homepage

梦过后 2024-10-28 16:22:16

如果您坚决不使用 X 客户端,请尝试查看 emacs 的 ediff。这适用于文本模式(尽管在 X 中更容易)。

If you're dead set on not using an X client, try taking a look at emacs' ediff. That works in text mode (though it's easier in X).

只是在用心讲痛 2024-10-28 16:22:16

我猜你正在谈论用三向差异工具解析文件。不同的版本都是你的,

  • 现在

做到这一点,需要在 Linux 中进行一些设置。我有一个 .p4config 文件,它定义了我更喜欢的 diff 工具。

P4CLIENT=mywork
P4DIFF=diff -u
P4EDITOR=vi
P4IGNORE=.p4ignore

这里 P4DIFF 设置为 diff -u。为了使整个事情正常工作,需要通过环境变量将 .p4config 文件插入到 perforce。

export P4CONFIG=.p4config

现在是最佳点。我们实际上需要通过 p4 resolve 命令进行解析。

p4 resolve /path/to/mysource.h

一旦我们这样做,就会表明存在冲突,因为有人修改了我们正在工作的原始版本。所以它提示我们采取行动。

/path/to/mysource.h - merging //stream/version/path/to/mysource.h#2
Diff chunks: 13 yours + 2 theirs + 0 both + 1 conflicting
Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) e: d

我们可以通过按d来查看差异。

--- /path/to/mysource.h 2016-09-28 18:34:54.918709150 -0400
+++ /path/to/tmp.6365.102   2016-09-29 11:05:32.228946564 -0400
@@ -16,6 +16,7 @@
we are same in all branches
same as everywhere 
+ added line
more same

@@ -28,7 +29,12 @@
here you go the conflict
+>>>> ORIGINAL //stream/version/path/to/mysource.h#1
+ the original line is here
+==== THEIRS //stream/version/path/to/mysource.h#2
+ their line is here
+==== YOURS /path/to/mysource.h
my line is here
+<<<<
Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) e: e

现在可以修复这个输入e。它将打开一个编辑器,我们可以在其中比较 +==== 行和 +<<<<< 行之间的不同版本。

完成编辑后,我们可以通过输入 a 来接受。

Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) ae: a

整个过程可以从远程命令/shell 窗口完成。所以不需要X-server。

I guess you are talking about resolving files in three way diff tool. The different versions are,

  • ORIGINAL
  • THEIRS
  • YOURS

Now, to do that a little setup is needed in linux. I have a .p4config file that defines my preferable diff tool.

P4CLIENT=mywork
P4DIFF=diff -u
P4EDITOR=vi
P4IGNORE=.p4ignore

Here P4DIFF is set to diff -u. To make the whole thing work the .p4config file needs to be plugged to perforce by environment variable.

export P4CONFIG=.p4config

Now it is the sweet-spot. We need to actually do the resolve by p4 resolve command.

p4 resolve /path/to/mysource.h

As soon as we do that, it shows that there is conflict as someone modified the original version we were working. So it prompts for our action.

/path/to/mysource.h - merging //stream/version/path/to/mysource.h#2
Diff chunks: 13 yours + 2 theirs + 0 both + 1 conflicting
Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) e: d

We can see the diff by pressing d.

--- /path/to/mysource.h 2016-09-28 18:34:54.918709150 -0400
+++ /path/to/tmp.6365.102   2016-09-29 11:05:32.228946564 -0400
@@ -16,6 +16,7 @@
we are same in all branches
same as everywhere 
+ added line
more same

@@ -28,7 +29,12 @@
here you go the conflict
+>>>> ORIGINAL //stream/version/path/to/mysource.h#1
+ the original line is here
+==== THEIRS //stream/version/path/to/mysource.h#2
+ their line is here
+==== YOURS /path/to/mysource.h
my line is here
+<<<<
Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) e: e

Now it is possible to fix this typing e. It will open an editor where we can compare the different versions in between the +==== lines and +<<<< lines.

Once we are done with editing we can accept by typing a.

Accept(a) Edit(e) Diff(d) Merge (m) Skip(s) Help(?) ae: a

The whole process can be done from remote command/shell window. So there is no X-server is needed.

咽泪装欢 2024-10-28 16:22:16

我有一个名为 diff3 的东西,它有一个合并选项。我不确定它是从哪里来的,我也没有使用过它。 diff3 -m file1 file2 file3。接受它的价值。

顺便说一句,我正在运行 OpenSuSE 11.2,如果有帮助的话。

I have something called diff3, which has a merge option. I'm not sure where it came from and I have not used it. diff3 -m file1 file2 file3. Take it for what it's worth.

Btw, I'm running OpenSuSE 11.2, if that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文