xiemeilong
xiemeilong

Reputation: 693

How and when do Mercurial or git diff files?

I am on a project about file sync. I have some questions:

Upvotes: 1

Views: 193

Answers (1)

Lasse V. Karlsen
Lasse V. Karlsen

Reputation: 391426

For Mercurial, it differs between showing a diff, and storing the diff.

When showing the diff, it depends on whether you ask Mercurial itself to show the diff, or if you ask it to use an external diff program.

Here are all the combinations:

  1. Storing the diff
    1. Always uses binary diff, does not matter what kind of file it is (or is assumed to be)
  2. Showing the diff
    1. Asking Mercurial to show the diff
      1. Will complain if it is a binary file (that is, that Mercurial assumes it is a binary file)
      2. Will show the diff if it is a text file (again, assumed)
    2. Asking external program to show the diff
      1. Depends on what that external program is able to handle

As for monitoring the changes, Mercurial does not do this. When you ask it to commit, at that point it figures out which files to store and what changes to commit for them.

Upvotes: 2

Related Questions