home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / misc / discuss / 4383 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  5.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!sbusol.rz.uni-sb.de!sbusol.rz.uni-sb.de!ph12hucg
  2. From: ph12hucg@sbusol.rz.uni-sb.de (Carsten Grammes)
  3. Newsgroups: gnu.misc.discuss
  4. Subject: Re: Summary of answers (GNU diff question)
  5. Date: 11 Jan 1993 09:25:37 GMT
  6. Organization: Universitaet des Saarlandes,Rechenzentrum
  7. Lines: 109
  8. Message-ID: <1ireehINN29k@sbusol.rz.uni-sb.de>
  9. NNTP-Posting-Host: sbusol.rz.uni-sb.de
  10.  
  11. Many thanks to those who helped me with my question. As at least one
  12. (Vince) thought it a general question I will give a summary of the
  13. answers.
  14.  
  15.  
  16. From: Vince Tessier <vtessier@vela.acs.oakland.edu>
  17.  
  18. What you now need is patch, probably also available for DOS.  Patch takes
  19. the file produced by diff and applies it to a source file, producing the
  20. new file.  A ficticious example:
  21.  
  22. You've got floob-1.3.tar.Z, a huge file.  You see announced on the net
  23. floob-1.4.tar.Z, even bigger, along with a notice that 
  24. floob-1.3-1.4.diff.Z is available, only 10% of the size of either .tar
  25. file.  You don't want to download all of floob-1.4.tar.Z, so you get
  26. the diff file.
  27.  
  28. With the 1.3 sources in a nearby directory, and the diffs uncompressed,
  29. you type (in Unix)
  30.     patch < floob-1.3-1.4.diff
  31. and all the 1.3 source files are automagically updated to 1.4.
  32.  
  33. Patch is a really wonderful program, written by Larry Wall, the same
  34. guy that invented Perl.
  35.  
  36. [flame^H^H^H^H^H well meant advice deleted...]
  37.  
  38.  
  39. Reply-To: dodd@roebling.poly.edu
  40.  
  41. get patch from prep.ai.mit.edu it uses context diffs to update files. also,
  42. GNU diff comes with an texinfo document that covers (superbly) diff and patch.
  43. You can get a hard copy from the texinfo file with TeX or create an info page
  44. for use with GNU emacs.  I could send you the info file output if you can't
  45. create it.
  46.  
  47.  
  48. From: strombrg@uceng.uc.EDU (Dan Stromberg)
  49.  
  50. diff -c (or diff -C3 for older versions) will produce a context diff.
  51. Differences are given both in terms of line numbers, and contextual
  52. information, so if line numbers change a little, the "right place" can
  53. still usually be found.
  54.  
  55. patch -p0 < file.diff can be used to apply such a patch.  I know
  56. there's a patch binary in existence for MS-DOS; I used one back when I
  57. was running DOS (and wishing I had a UNIX - now I use Linux, after a
  58. motherboard upgrade).  It might well be in the CBIP archive.
  59.  
  60. I've applied normal (non-context) diff's with patch, but the success
  61. rate is inherently lower, statistically speaking.
  62.  
  63. From: mcastle@cs.umr.edu
  64.  
  65. The source for gnu-diff can be found on prep.ai.mit.edu among other sites
  66. (probably a close one to you) in pub/gnu/diff*.tar.Z  where * has the version
  67. number and all in it.  If you get that, there are probably some *.texi and/or
  68. some *.info files.  These are for the favored gnu doc format, texinfo.  
  69. (The *.texi files are the source for the docs.  You can run them through 
  70. TeX and using some gnu supplied macros and extra stuff make some nifty
  71. printed docs. Or run the same *.texi files through emacs with it's texinfo
  72. mode and create *.info files that are basically hypertext help files).
  73. On simtel20, ind pd1:<msdos.gnuish> there should be and info*.zip package
  74. that is a standalone texi->info processor and an info reader.  You may
  75. want to try those to read the docs that come with the diff source. 
  76.  
  77. If you have access to a unix system, doing a 'man diff' will get you a lot
  78. of useful information.  Gnu just tends to make their software run faster
  79. and add nifty command line options (such as using --context=2 rather than 
  80. -c2 or --recursive rather than -r).  
  81.  
  82. For producing diff's suitable for use with the program 'patch' you want
  83. to make a context diff.  A context diff tries to place any changes made
  84. to files within a context of what the orginal file looked like.  It does
  85. this by listing a few lines before and after the block of changes (the 
  86. number supplied with --context above), showing lines in old, then lines
  87. in new file.  This diff can then be used to 'patch' a file that may
  88. not be identical to the file used to generate the patch.  For examples,
  89. 2 people find 2 different bugs (or add 2 different features) to a 
  90. program.  Now the line numbers of the resulting code for both people will
  91. not necessarily match, but patch will heuristically search an area around
  92. the line number supplied in the patch to try and apply the patch anyway
  93. (this is why the 'context' is so important).  
  94.  
  95. To create a context diff, do the following
  96.  
  97. diff --context oldfile newfile > file.dif
  98.  
  99. A person will then do 
  100.  
  101. patch < file.dif
  102.  
  103. and patch will automagically apply the patch (and make a backup of the 
  104. original file).
  105.  
  106. if you want to make context diffs of a whole subdir, I think 
  107.  
  108. diff --recursive --context olddir newdir > dir.dif
  109.  
  110. will create a diff usable by patch, but I'm not 100% positive on this point.
  111.  
  112.  
  113. *********************************************************************
  114. Carsten Grammes            Internet: ph12hucg@rz.uni-sb.de
  115. Experimental Physics        Voicenet: 49-681-302-3032
  116. Universitaet Saarbruecken    Faxnet  : 49-681-302-4316
  117. 6600 Saarbruecken
  118. Germany
  119. *********************************************************************
  120.