dummy question: diff

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • will_asher
    DaJAngband Maintainer
    • Apr 2007
    • 1124

    dummy question: diff

    How do you make a diff?

    (I understand that that is a record of all the differences between two files or groups of files, correct me if I'm wrong)

    I googled it and found this:


    I tried to take it's advice and I got
    "'diff' is not recognized as an internal or external command, operable program or batch file."
    Will_Asher
    aka LibraryAdventurer

    My old variant DaJAngband:
    http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)
  • zaimoni
    Knight
    • Apr 2007
    • 590

    #2
    Originally posted by will_asher
    How do you make a diff?

    (I understand that that is a record of all the differences between two files or groups of files, correct me if I'm wrong)

    I googled it and found this:


    I tried to take it's advice and I got
    "'diff' is not recognized as an internal or external command, operable program or batch file."
    diff is a *NIX utility. If you're on Windows, you need to install the relevant chunk of either MingW32 or CygWin (I use MingW32).

    Any decent source code control system will also provide diff functionality (SVN/Git/Mercurial/..., unsure about CVS).
    Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
    Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
    Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

    Comment

    • krugar
      Apprentice
      • Sep 2010
      • 76

      #3
      If you want to go directly to the programs, you can download the GNU Diffutils package.

      Personally I also like colordiff. This is a perl script that wraps around diff and outputs in color. Quite useful if you appreciate syntax coloring. To facilitate usage, you can add the following to your shell settings file (usually ~/.bashrc if you are using bash)

      Code:
      alias diff='colordiff'

      Comment

      • will_asher
        DaJAngband Maintainer
        • Apr 2007
        • 1124

        #4
        okay I downloaded diiffutils and extracted it from the archive. now what?

        what directory do these files have to be in for diff to work?
        I don't see any file called diff...?
        Will_Asher
        aka LibraryAdventurer

        My old variant DaJAngband:
        http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Originally posted by will_asher
          okay I downloaded diiffutils and extracted it from the archive. now what?

          what directory do these files have to be in for diff to work?
          I don't see any file called diff...?
          Will, Krugar is using Linux and you, IIUC, are using Windows. As Zaimoni said, you'll need either mingw32 or cygwin.

          The usual syntax is

          diff -u file1 file2 >outputfile.diff

          or

          diff -u dir1 dir2 >outputfile.diff

          (the -u tells it to use the "unified diff" format)

          But if you're using svn or git you can just type "svn diff" or "git diff" to get the changes against the latest checked out revision.
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • Timo Pietilä
            Prophet
            • Apr 2007
            • 4096

            #6
            Originally posted by krugar
            If you want to go directly to the programs, you can download the GNU Diffutils package.
            That's wrong link to diffutils (you posted colordiff twice).

            GNU diffutils is a right one.

            (EDIT)
            Windows diffutils:
            DiffUtils for Windows
            Last edited by Timo Pietilä; September 12, 2010, 10:08.

            Comment

            • Timo Pietilä
              Prophet
              • Apr 2007
              • 4096

              #7
              Originally posted by will_asher
              okay I downloaded diiffutils and extracted it from the archive. now what?

              what directory do these files have to be in for diff to work?
              I don't see any file called diff...?
              You probably downloaded diffutils for linux/unix systems.

              Here is link for windows utils:

              DiffUtils for Windows

              Comment

              • Pete Mack
                Prophet
                • Apr 2007
                • 6883

                #8
                If you are doing a diff vs the main (svn) branch, the best option is to use svn diff. (TortoiseSVN explorer plugin has it too.)

                Comment

                • zaimoni
                  Knight
                  • Apr 2007
                  • 590

                  #9
                  Originally posted by will_asher
                  what directory do these files have to be in for diff to work?
                  I don't see any file called diff...?
                  Hmm...wrong archive, then.

                  When you do have a file called diff.exe , it will need to be in your PATH. I find it simplest to maintain a *NIX-like directory system, and adjust my PATH to make sure the directory corresponding to /bin is in it. [Do this from the System control panel; it's an "advanced" function supposedly, will trigger UAC to adjust it.]

                  For my MingW32-based setup, I use the following for my *NIX-like directories

                  Code:
                  c:\bin  [diff and other typical *NIX utilities goes here; in PATH]
                  c:\etc [for bash and a few other utilities]
                  c:\usr\local\include [for GCC]
                  c:\usr\local\lib [for GCC]
                  Note that this is not a standard MingW32 install, I'm breaking practically all typical install shell scripts in exchange for having everything "just work" almost everywhere on the main hard drive.

                  For working in C++, the following are also in my PATH
                  Code:
                  c:\dev.tools\bin [unpack binutils in c:\dev.tools so I can update without trashing my GCC installs]
                  c:\MingW32\bin [rename whatever MingW32 compiler suite's directory I want to work in to this]
                  I currently have installed:
                  Code:
                  c:\MingW32.345 [3.4.5 works, binaries tend to be bloated]
                  c:\MingW32.421 [4.2.1 works, atexit and friends highly unstable]
                  c:\MingW32.433 [4.3.3 works]
                  c:\MingW32.441 [4.4.1 won't build libJPEG or libPNG by generating invalid assembly, so generally useless]
                  c:\MingW32.450 [4.5.0 won't build libJPEG or libPNG by generating invalid assembly, so generally useless]
                  I normally use MingW32 4.3.3 unless specifically checking backward compatibility, or faced with source code that ICE's on 4.3.3.
                  Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
                  Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
                  Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

                  Comment

                  • will_asher
                    DaJAngband Maintainer
                    • Apr 2007
                    • 1124

                    #10
                    Originally posted by Timo Pietilä
                    You probably downloaded diffutils for linux/unix systems.

                    Here is link for windows utils:

                    DiffUtils for Windows
                    Ah yes, that would probably be my problem. thanks

                    Nice that I can get diffutils without having to learn how to use MingW32 or svn. I've never used either and I don't think it's worthwhile for me to learn them. I don't really plan to become a serious programmer.
                    Will_Asher
                    aka LibraryAdventurer

                    My old variant DaJAngband:
                    http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)

                    Comment

                    • Pete Mack
                      Prophet
                      • Apr 2007
                      • 6883

                      #11
                      You don't have to be a serious programmer to use source control. It is very, very useful if you are maintaining a long-term project.

                      Comment

                      • AnonymousHero
                        Veteran
                        • Jun 2007
                        • 1393

                        #12
                        Originally posted by will_asher
                        Ah yes, that would probably be my problem. thanks

                        Nice that I can get diffutils without having to learn how to use MingW32 or svn. I've never used either and I don't think it's worthwhile for me to learn them. I don't really plan to become a serious programmer.
                        You shouldn't learn svn, but you should learn something simpler like Mercurial (hg) or Bazaar (bzr). Neither of those require any server type setup and source control is essential for long-term maintenance on any project. (I know it may be hard to imagine if you haven't tried, but just trust me. You'll be happier for it.)

                        Comment

                        • will_asher
                          DaJAngband Maintainer
                          • Apr 2007
                          • 1124

                          #13
                          Yeah, I'm just now getting around to continuing what I was doing here..
                          Anyway, I have now installed the windows version of diffutils, and I have the same questions I had before. There still doesn't seem to be any executible.
                          (It could really use some better documentation. All the documentation seems to assume you can get the command prompt to recognise what 'diff' means)

                          Originally posted by will_asher
                          okay I downloaded diiffutils and extracted it from the archive. now what?

                          what directory do these files have to be in for diff to work?
                          I don't see any file called diff...?
                          Will_Asher
                          aka LibraryAdventurer

                          My old variant DaJAngband:
                          http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)

                          Comment

                          • Timo Pietilä
                            Prophet
                            • Apr 2007
                            • 4096

                            #14
                            Originally posted by will_asher
                            Yeah, I'm just now getting around to continuing what I was doing here..
                            Anyway, I have now installed the windows version of diffutils, and I have the same questions I had before. There still doesn't seem to be any executible.
                            (It could really use some better documentation. All the documentation seems to assume you can get the command prompt to recognise what 'diff' means)
                            Binaries are in %programfiles%\GnuWin32\bin You might need to add that to path.

                            Comment

                            • will_asher
                              DaJAngband Maintainer
                              • Apr 2007
                              • 1124

                              #15
                              Originally posted by Timo Pietilä
                              Binaries are in %programfiles%\GnuWin32\bin You might need to add that to path.
                              How do you do that?

                              EDIT: nevermind, I did a google search and found how to change the path.
                              Last edited by will_asher; September 19, 2010, 05:19.
                              Will_Asher
                              aka LibraryAdventurer

                              My old variant DaJAngband:
                              http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎