tags:

views:

460

answers:

4

Hello, I have something like this

src/sim/simulate.cc
41d40
< #include "mem/mem-interface.h"
90,91d88
<             dram_print_stats_common(curTick/500);
<
src/mem/physical.hh
52d51
<   public:
55,56d53
<       public:
<
58a56,57
>       public:
>
61,62c60,61
<         virtual bool recvTiming(PacketPtr pkt); //baoyg
<
---

I believe this was created using the diff command in a source tree. What I want is create the patch using that output, to apply the same changes to my source tree. I do not have many idea about this, so correct me If my question does not make any sense.

Thank you.

+1  A: 

I believe that diff -u oldfile newfile > a.patch is used to create patch files, although some other switched may be thrown in as well (-N?).

R. Bemrose
+1  A: 

What you have there is a non-unified diff. patch can read it, but will be unable to make context matches and is more likely to make mistakes.

Sparr
So what should I do?, do the changes manually, I have a bunch of them or give it a try with patch?. Is the right command to create the patch the one provided by R. Bemrose?.
Eduardo
Make a backup, of course. Then apply the patches to one specific file at a time (non-unified diffs do not tell which file(s) they apply to). diff -u is a virtually universal standard, other options provide more robustness and compatibility with other systems, as Andrei pointed out re svn diff
Sparr
A: 

That is a (partial) patch file, though it would have been better if they provided you with a unified diff output.

The main issue with that patch is that it doesn't mention which files are being modified, and since there is no context provided, the files must be exact, patch will be unable to allow for minor changes in the file.

Arafangion
A: 

If you want to get the same patch output as SVN diff, given two different files:

diff -Naur file1.cpp file2.cpp

Andrei Taranchenko