2011-09-21 43 views
0

我剛開始使用mercurial(用於windows)。根據教程http://hginit.com/01.html我做了存儲庫等,但diff命令不顯示我在文件中所做的任何更改。你有什麼想法是什麼錯誤? 在此先感謝!Mercurial - 爲什麼不區分工作?

+0

如果您想允許我們提供幫助,您必須提供您使用的命令行和結果。 – Klaim

+0

在做'hg diff'之前你做過'hg commit'嗎?如果是這樣,則不會顯示任何更改。 – nye17

回答

2

默認情況下,如果命令hg diff將顯示工作目錄,與其父之間的差異。正如nye17所建議的那樣,如果在運行hg diff之前已經做了一些更改,那麼工作目錄將與其父目錄相同,並且不顯示輸出。在這些情況下,您可以通過運行hg diff -c -1來查看進行了哪些更改。這將在先前的(-1)變更集上運行hg diff命令。

2

基本步驟如下:

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