I performed these steps:
- Commited my project
- Added a couple class files to my project
- Decided I wanted to completely abandon what I had just done
- Used TortoiseHg Repository Explorer to Update to last changeset with "Discard local changes, no backup (-C/--clean)" checked/turned on
The two class files I added did not get deleted as I would have expected. They appear in the folder without shell icons.
Questions
- Is this correct behavior or a bug?
- If this is correct, is there a feature that will allow me to go back to a previous changeset without endin开发者_Python百科g up with a bunch of junk files in my working copy?
Even if you hg add
the files, if you haven't committed them, when you update it leaves the files as unknown files. Example:
C:\> md test
C:\> cd test
C:\test> hg init
C:\test> echo >file1
C:\test> hg ci -Am file1
adding file1
C:\test> echo >file2
C:\test> echo >file3
C:\test> hg add
adding file2
adding file3
C:\test> hg st
A file2
A file3
C:\test> hg update -C
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
C:\test> hg st
? file2
? file3
If you enable the purge extension, then hg purge
will delete files with ?
status. Be careful because files you meant to add to your project but haven't yet will be deleted:
C:\test> hg add file2
C:\test> hg status
A file2
? file3
C:\test> hg purge
C:\test> hg status
A file2
If you don't have added the files to you repository, I think they are not at all under version control. That will also mean they are left alone by the version control system, and you'll have to delete them yourself if you want them to be deleted.
Only if you have actually put them under version control (added them to the repository), you will have to revert your changes, or explicitly delete them from you repository.
The reason for this is of course that you may need some files in your project directory that you don't want to be in your version control repository at all.
Use hg update null
on your working folder. Check the docs.
精彩评论