Kate Anishkina
Kate Anishkina

Reputation: 3

Mercurial - why doesn't diff work?

I have just started to use mercurial (for windows). According to the tutorial http://hginit.com/01.html I made repository, etc. But diff command doesn't show any changes that I made in files. Do you have any ideas what is wrong? Thanks in advance!

Upvotes: 0

Views: 1311

Answers (2)

icabod
icabod

Reputation: 7084

By default, if the command hg diff will show differences between the working directory, and its parent. As nye17 suggested, if you have committed some changes just prior to running hg diff then the working directory will be the same as its parent, and show no output. In these instances, you can see what changes were made in by running hg diff -c -1. This will run the hg diff command on the previous (-1) changeset.

Upvotes: 2

pyfunc
pyfunc

Reputation: 66739

Basic steps are as follows:

hg init .       ---- This make the current directory as blank hg repository

echo "XYZ" > test.txt   --- This creates a new file which is not added to version control yet.

hg add test.txt --- The file is added to repo for commit

hg commit test.txt -m "added file test.txt"  --- Now you can commit the file

hg log  ----- to see the log

hg diff test.txt ----- will show no diff as the latest file committed is same

echo "TTTT" >> test.txt   ----- make some changes

hg diff test.txt   -------- should show the difference of current file to latest in commit

hg commit test.txt -m "second commit"  ----- now once you have committed, latest in repo and working directory is same

hg diff test.txt ------ this diff should again be blank

Upvotes: 2

Related Questions