How do I revert a file to ‘last checkin’ state in Mercurial?
There is a mercurial command to revert files. hg revert this should revert any changes. You can also pass a file name to it e.g hg revert fileName.
There is a mercurial command to revert files. hg revert this should revert any changes. You can also pass a file name to it e.g hg revert fileName.
Yes you can, but this is not documented anywhere. I’ve used this technique for a long time, don’t worry, it is safe. Instead of updating, you can issue the following commands hg debugsetparent <revision> hg branch <branchOfRevision> Note that the order is important. This will make your repo think it is on the new revision, … Read more
If you haven’t committed yet, you can simply do a clean reset as per the manual (http://www.selenic.com/mercurial/hg.1.html#commands): hg branch -C This will reset the working directory’s branch name to the parent of the branch that you just created.
The example you give is more a Merge than really a Close. Also, if it’s that simple, you probably don’t want/need to create a named branch. But if you really want to close a branch through TortoiseHg, eg you created the NewFeature branch then both the Default branch and NewFeature branches were modified then if … Read more
Update: According to the Mercurial config documentation the defaults section is deprecated. The Mercurial wiki is also particularly critical of their use. The recommended replacement is to create a command alias (while not shadowing built in commands) that provides the functionality you are looking for. Here’s what I’ve switched to in my config. [alias] undo … Read more
No, because a tag is an entry in the .hgtags file at the root of your repository containing the changeset id and the tag name, and this file itself is under revision control. The changeset id isn’t known until the changeset is created, so tagging creates another changeset to check in the .hgtags file recording … Read more
If you don’t want to use shelve, you can do it with just 3 commands: hg diff > mylocalchanges.txt hg revert -a # Do your merge here, once you are done, import back your local mods hg import –no-commit mylocalchanges.txt
Thanks for the revset examples. I fiddled around and found this solution that I kind of like: hg log -r “parents(min(branch(foo)))” which will print the revision that the first commit on the foo branch was based on. You can look for the branch (or lack thereof indicating the default branch) in that changeset and that … Read more
You can use hg reflog (from the journal extension) and hg reset <hash>. hg reflog -v should give something like: <old-hash> -> <new-hash> <user> <timestamp> commit –amend <some-path> if that is the amend you want to revert, just use: hg reset <old-hash> The commit will be reverted to what is previously was and the changes … Read more
Use hg log –follow foo2.txt or hg log -f foo2.txt (short form) to show you the entire history of the file before the hg rename