how to read

Discuss Programming

how to read

Postby worker201 » Tue May 17, 2005 2:39 pm

How does one read 'changelogs'? Take this one for example:
http://livna.org/pipermail/subversion/2 ... 00862.html

I don't want to use this information, but I am interested in knowing how these patch pages work. I know what '+' and '-' mean, but '+-' and '++' baffle me. Could someone maybe describe what this stuff means exactly, and there is some program that creates them?
worker201
guru
guru
 
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Re: how to read

Postby Tux » Tue May 17, 2005 3:00 pm

worker201 wrote:How does one read 'changelogs'? Take this one for example:
http://livna.org/pipermail/subversion/2 ... 00862.html

I don't want to use this information, but I am interested in knowing how these patch pages work. I know what '+' and '-' mean, but '+-' and '++' baffle me. Could someone maybe describe what this stuff means exactly, and there is some program that creates them?


They are created by diff and applied with patch.
They just describe the lines changed, removed and added in a particular source file.
Tux
guru
guru
 
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Postby worker201 » Tue May 17, 2005 3:18 pm

Good, thanks for the basics.

But what does '+-' mean, when applied to a line?
worker201
guru
guru
 
Posts: 668
Joined: Sun Jun 13, 2004 6:38 pm
Location: Hawaii

Postby Void Main » Tue May 17, 2005 6:05 pm

Patches really have nothing to do with Changelogs. The message you point to with the patch snippets actually looks screwed up on the first half, like someone manually changed some things and screwed it up. The second half looks ok.

diff/patch really are pretty easy to understand. To create patch files I usually like to use this command:

Code: Select all
$ diff -Naur oldfile newfile > my.patch


Take any file, say "file1.txt". Make an exact copy of it say "file2.txt". Now make a couple of changes to a couple of lines in file2.txt and do this:

Code: Select all
$ diff -Naur file1.txt file2.txt > my.patch


Examine "my.patch". You will notice the first two lines start with "---" which is the original file and "+++" is the file that has been changed along with the date/time stamps. The numbers between the "@@" are the starting line number and number of lines that the snippet comes from. The lines that start with "-" are deletions and the lines that start with "+" are additions. Changed lines will show up as a deleted line and an added line. Using the "patch" command on "file1.txt" using your "my.patch" file you would end up with "file2.txt".

That's really about it. You can run the "diff -Naur" on entire directories and create a single patch file. You will see multiple "---" and "+++" lines for the file names in this case.
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron