公司目前的版本管理工具是cvs,但准备逐渐引入Mercurial,未来不再支持cvs,所以大家都开始学习Mercurial,今天上网看了看,在这里做点记录,为己也为大家。
1. Add a new folder in which you want to work.
$ hg init project
2. Add files and track them
$ cd project
$ (add files)
$ hg add /* add all files*/
$ hg add file0 file1 /* add specific files */
$ hg commit /* same as hg ci */
3. Save changes
$ (do some changes)
$ hg status /* see which files changed, which have been added or removed. */
$ hg diff /* see the exact changes */
$ hg commit
or$ hg commit -m "MESSAGE"
4. Move and copy files
$ hg cp src.c dest.c
$ hg commit
$ hg mv src.c dest.c
$ hg commit
5. Check the history
$ hg log
6. Seeing an earlier revision
$ hg update 1.3 /* revision number*/ /* or hg up 1.3*/
/* after this command, the code is back at revision 1.3 */
/*check if you are really at that revision */
$ hg identify -n
/*To update to the most recent revision. */
$ hg update tip
7. Fixing errors in earlier revisions
/* let's assume that the bug was introduced in revision 1.3 */
$ hg update 1.3
$ (fix the bug)
$ hg commit
/* Then merge to the current version */
$ hg merge
/* when there are conflicts */
/* first list the files with conflicts */
$ hg resolve --list
$ hg resolve conflicting_file /* fix it by hand, if nescessary */
$ hg commit
1. Add a new folder in which you want to work.
$ hg init project
2. Add files and track them
$ cd project
$ (add files)
$ hg add /* add all files*/
$ hg add file0 file1 /* add specific files */
$ hg commit /* same as hg ci */
3. Save changes
$ (do some changes)
$ hg status /* see which files changed, which have been added or removed. */
$ hg diff /* see the exact changes */
$ hg commit
or$ hg commit -m "MESSAGE"
4. Move and copy files
$ hg cp src.c dest.c
$ hg commit
$ hg mv src.c dest.c
$ hg commit
5. Check the history
$ hg log
6. Seeing an earlier revision
$ hg update 1.3 /* revision number*/ /* or hg up 1.3*/
/* after this command, the code is back at revision 1.3 */
/*check if you are really at that revision */
$ hg identify -n
/*To update to the most recent revision. */
$ hg update tip
7. Fixing errors in earlier revisions
/* let's assume that the bug was introduced in revision 1.3 */
$ hg update 1.3
$ (fix the bug)
$ hg commit
/* Then merge to the current version */
$ hg merge
/* when there are conflicts */
/* first list the files with conflicts */
$ hg resolve --list
$ hg resolve conflicting_file /* fix it by hand, if nescessary */
$ hg commit