We recently re-organized a very unorganized site on our server at work. This website is version controlled using Mercurial. We re-organized everything. Thousands of files. Now when I do a hg status
it shows a ton of new untracked files represented by a ?
and tons of missing files, which are the same files as the untracked ones, represented by a !
.
How do I tell Mercurial that we moved these files? I know I can do it one-by-one, but this isn't an option given that there are thousands of them.
To revert a file to a specific changeset, use hg revert -r CHANGESET FILENAME . This will revert the file without committing it.
Add the Mercurial Extension called purge. It is distributed by Mercurial. It is not enabled by default, maybe to avoid accidentally removing files that you forgot to add.
hg status shows the status of a repository. Files are stored in a project's working directory (which users see), and the local repository (where committed snapshots are permanently recorded). hg add tells Mercurial to track files. hg commit creates a snapshot of the changes to 1 or more files in the local repository.
You can use hg mv --after
to signify you have already moved the file.
hg addremove
will detect renames after-the-fact if the files are 100% similar by default, and the similarity threshold can be overridden with -s
.
Also, if using TortoiseHg, thg guess
will bring up a dialog where you can use a slider to set the similarity and view the resulting matches between added and deleted files, then select the pairs you want to record as a rename.
Example:
C:\>hg init test C:\>cd test C:\test>echo >file1 C:\test>echo ONE>file1 C:\test>echo TWO>file2 C:\test>hg ci -Am init adding file1 adding file2 C:\test>ren file1 file3 C:\test>ren file2 file4 C:\test>hg st ! file1 ! file2 ? file3 ? file4 C:\test>hg addrem removing file1 removing file2 adding file3 adding file4 recording removal of file1 as rename to file3 (100% similar) recording removal of file2 as rename to file4 (100% similar) C:\test>hg status -C # -C shows file copies. A file3 file1 # file3 copied from file1... A file4 file2 # file 4 copied from file2... R file1 R file2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With