Results 1 to 6 of 6

How to write a patch

  1. #1
    Jedi knight Luke Skywalker's Avatar
    Join Date
    Jul 2009
    Posts
    2,174

    Default How to write a patch

    Recently a member have asked me how to write a patch.As in my previous thread I explain how to apply a patch, Now what are you gonna do if you want to some one yourself? Write a patch. It is a quick was to get to be known by all.
    Example You have a file name L.txt containing a line :

    Luke Vader is a Jedi knight
    Well you wrote your another same as above but updated with line :

    Luke Skywalker is a Jedi Knight.
    After writing the patch type this:

    diff -c originalfile updatedfile > patchfilename.patch
    But many a time you will find bugs reported in many files of directory. Then type this:

    diff --crB /orginal/directory /updated/directory > patchfilename.patch.

    Hurray patch is complete. But before submitting test it on your self.
    patch --dry-run -p0 patchfilename.patch

    if its working then submit it.
    Not always will you be lucky to find the solution posted but you will have to find them yourself.
    Last edited by Luke Skywalker; 11th February 2010 at 08:18 PM.

  2. #2
    mrhannette
    Guest

    Default

    Hi,

    I'm looking for these details from so many days. Thank you

  3. #3
    Sanjeev_man
    Guest

    Smile

    Quote Originally Posted by mrhannette View Post
    Hi,

    I'm looking for these details from so many days. Thank you
    Your most welcome, 'We are always there to contribute you'
    So any queries further are most welcome

  4. #4
    Junior Member
    Join Date
    Apr 2010
    Posts
    45

    Default

    Great post!

    For all curious Linux users, the great than sign ('>') means output will be stored to the file. You can use it for almost any CLI (command-line interface) program. If you want to take a good look at the diff before making it a patch file, I'd suggest you use:
    Code:
    diff -c originalfile updatedfile | less
    You can use the slash key ('/') to search for things within the diff.

    Luke, I have a question. I understand that on most VCS's the diff command output is not the same as that of the diff you've just explained here. And if I'm not using a DVCS, it isn't very simple to branch (will have to spend bandwidth downloading). Is there any simple way to generate a patch when I'm already using a VCS like hg, bzr or svn? Thanks!

  5. #5
    m2h_katie
    Guest

    Thumbs up

    Hello,

    Thank you for sharing these details with us. I have tried and it works.

    Thank you so much.

  6. #6
    Junior Member
    Join Date
    Dec 2010
    Posts
    3

    Default Thank

    Dear sir,
    i am very thank full to you for this kind information. I am trying it.and taking its a advantages.

Similar Threads

  1. How to write..
    By bingbang in forum BSNL broadband
    Replies: 3
    Last Post: 23rd February 2011, 04:15 PM
  2. DVD Writer can't read or write
    By mickey in forum Desktop Computer
    Replies: 5
    Last Post: 23rd April 2010, 05:42 PM
  3. DVD read write problem
    By prasanta08 in forum Computer Accessories
    Replies: 12
    Last Post: 28th December 2009, 09:56 PM
  4. Bootloader is unable to write new MBR.
    By puchu in forum Linux
    Replies: 2
    Last Post: 14th October 2009, 01:17 PM
  5. New style to write 0,1,2,3,4,5,6,7,8
    By oo7 in forum General offtopic discussions
    Replies: 8
    Last Post: 17th July 2009, 08:33 PM