Subject: [Dev] Questions about patch?

From: Xinghua Shi <[email-masked]>
Date: Thu, 1 May 2003 14:39:09 -0500 (CDT)

Hey,James

  I saw your posts about how to create a patch using cvs and then do
patch. This is what I wanna do in my project(On Solaris), but I got some
problem here and couldn't figure out how to deal with this.
  Thanks for any hints. :-)

What I did is like:
1.create the patch using cvs
  cvs diff -c orbit.c > original_diff

2.original_diff looks like:

Index: orbit.c
===================================================================
RCS file: /u1/shi/cvs/Orbit/orbit.c,v
retrieving revision 1.7
diff -c -r1.7 orbit.c
*** orbit.c	28 Apr 2003 18:37:30 -0000	1.7
--- orbit.c	30 Apr 2003 18:02:16 -0000
***************
*** 1,5 ****

! char cvsroot_orbit_c[] = "$Header: /u1/shi/cvs/Orbit/orbit.c,v 1.7
2003/04/28 18:37:30 shi Exp $";

  #include <stdio.h>
  #include <stdlib.h>     /* for exit() prototype */
--- 1,5 ----

! char cvsroot_orbit_c[] = "$Header: /u1/shi/cvs/Orbit/orbit2.c,v 1.4
2003/04/22 18:44:30 shi Exp $";

  #include <stdio.h>
  #include <stdlib.h>     /* for exit() prototype */
***************
*** 194,199 ****
--- 194,202 ----
    /*
      this is still a test.
     */
+
+   printf("Blah,blah,this is my test!\n");
+

    fp = fopen("sim.out","w");
    printf("Running. Result in 'sim.out'\n");

3. do the patch
   patch -c -i original_diff orbit.c

But it complains:

Looks like a new-style context diff.
done

But nothing was done with the file orbit.c. Not any patching happened.

Actually, I don't know where to ask this question. So any suggestions are
heartly appreciated. :-)

Good day!

BR
-Mindy

---

From: Jon Carnes <[email-masked]>
Date: 01 May 2003 16:08:14 -0400

I don't know if this will help, but whenever I create patch files from
diffs I always grab a few reference lines around the changes.  Patch
seems to work much better then.  In fact if you read the "man diff" you
will see that it says:

     -lines Show  lines (an integer) lines of context.  This
            option does not specify an output format by itself;
            it has no effect  unless  it is combined with -c
            or -u.  This option is obsolete.  For proper
            operation, patch typically needs at least two lines
            of context.

Jon Carnes

On Thu, 2003-05-01 at 15:39, Xinghua Shi wrote:
> _______________________________________________
> Dev mailing list
> [email-masked]
> http://www.trilug.org/mailman/listinfo/dev

---

From: Xinghua Shi <[email-masked]>
Date: Thu, 1 May 2003 15:56:43 -0500 (CDT)

Thanks,Jon
  Then how to get this lines info from cvs diff? I read the "cvs diff
--help" and didn't figure out yet. Thanks for more hints. :-)

BR
-Mindy

---

From: [email-masked]
Date: Thu, 1 May 2003 17:59:27 -0400

> Actually, I don't know where to ask this question. So any suggestions are

If your version of patch supports the --verbose option, try the patch
again with that option, and see if it spits out anything meaningful.

TTYL,

Phillip Rhodes
Application Designer
Voice Data Solutions
919-571-4300 x225
[email-masked]

Those who are willing to sacrifice essential liberties for a little order,
will
lose both and deserve neither. - Benjamin Franklin

This country, with its institutions, belongs to the people who inhabit it.

Whenever they shall grow weary of the existing government, they can
exercise
their constitutional right of amending it, or exercise their revolutionary
right to overthrow it.  - Abraham Lincoln

No citizen shall be denied the right to bear arms, if as a last resort, to
protect themselves from tyranny in Government. - Thomas Jefferson

---

From: Jon Carnes <[email-masked]>
Date: 01 May 2003 19:22:04 -0400

> On 1 May 2003, Jon Carnes wrote:

Sorry I'm not that knowledgeable about CVS.

---

From: Tanner Lovelace <[email-masked]>
Date: 05 May 2003 00:25:47 -0400

> Sorry I'm not that knowledgeable about CVS.

I believe "cvs diff" takes the same options regular
diff takes.  In fact, it may just pipe to diff directly.

If this is not the case, could someone please correct me.

Thanks,
Tanner
-- 
Tanner Lovelace <[email-masked]>