You are not logged in.

#1 2012-03-06 10:42:33

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Create a patch?

Wittfella has kindly made a special piece of code, just for me, for his great filemanager Qtfm. I can apply it manually with the aid of nano. and it compiles fine. But, I've tried to make a patch with diff and patch but it is a bit over my IQ. Somehow I managed to reverse the patch and so destroyed the special code (backups are great).

Scenario;
Doc 1; special mainwindow.cpp complete or just with code snippet I need.
Doc 2; Qtfm newest source mainwindow.cpp

Desired result; put the code snippet from the special mainwinow.cpp into the new mainwindow.cpp, either from the complete file or a file with just the appropirate code sequence/snippet.

Of course, at one point the new code will change so that the special code snippet won't work anymore. But that's far off in the future.

Any hints are appreciated.

Offline

#2 2012-03-06 10:44:26

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Create a patch?

$ diff -Naur $file1 $file2 > $patch

should work fine in most cases.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2012-03-06 11:18:43

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: Create a patch?

.:B:. wrote:
$ diff -Naur $file1 $file2 > $patch

should work fine in most cases.

One thing I am confused about patches are, when using 'git diff' generated patches I have to do 'patch -Np1' while for other patches I have to use 'patch -Np1'. I don't understand the difference between -Np0 and -Np1 and the whole strip lines concept.

Offline

#4 2012-03-06 12:24:26

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Create a patch?

Have you read man patch? There are examples that I find quite useful.

Offline

Board footer

Powered by FluxBB