2011-09-21 57 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