I am using hg version 1.9.1. Problem is whenever I use hg update, I get an option of updating changed files. Do we have an option for forcefully updating all files to their new versions in the latest commit. Sorry but i did not find any useful information in hg manual.
hg update --clean
This will update your working directory with the newest version of files in the current branch. Please note that this command will discard all existing changes in your working directory.
If you meant "can I get a fresh copy of each and every file from the repository" just delete all files in your working directory and do a hg update --clean again.
Related
I have a situation where I renamed a few files I was tracking in a mercurial repo without using hg rename command (just doing it via the file system).
This occured several revisions ago
Now I want to return to a revision prior to the file renames, fix a bug, and then rebuild that old revision
problem i have is that i am getting error messages along the lines of:
remote changed file.txt which local deleted
use (c)hanged version or leave (d)eleted?
Is there a way I can fix the mistake I made when renaming the files all those revisions ago?
Depends on whether you committed the deletion of the files, but I assume you didn't and it doesn't seem so.
Then you can simply revert them in order to restore them to your working dir: hg revert file.txt. After that you can update to the previous revision without this question popping up. Alternatively just update to the previous revision you want to fix and accept the (c)changed version from remote.
If you want the rename to be permanent and also tracked by the repository, then commit that rename. Use hg addremove, possibly check with --dry-run first what it does so that no unwanted changes are added and commit the renaming of the files. Then go and update to the old revision and do whatever changes you want to commit there.
I deleted one of the files that was in my repository locally (just at the file system level, not using hg remove). I now want to get that file back from the repository to my local directory. When I do hg status, it knows that the file is locally deleted, but there are no changes to be commited which is what I would expect.
$ hg revert your-file
will restore it.
Edit: see http://www.selenic.com/mercurial/hg.1.html#revert
The following will revert all deleted files in the current repo:
hg status -nd0|xargs -0 hg revert
cd to your dir and do "hg revert ." to restore all files or used any appropriate mask like *.java, etc.. This will effect only the current dir (not sure about subdirs).
I'm using Mercurial and I've modified a file in my local computer.
hg status returns
M settings.py
But now I don't want to commit changes and I want to take back my file before last changes. How can I do it?
You can use hg update -C to update all tracked files to the working branch.
If you only want to revert a specific file use hg revert filename
I'm using Mercurial 1.7.2 Windows
I have a local repo where I copied some files into.Now I'd like to remove these files. I tried to use revert and update but those files are still there.
I tried these commands
hg revert --all
nothing, files stll there
hg update null
still nothing
I ran these commands from my repo using the commandline
Use PurgeExtension. It's a plugin for Mercurial. Purge is shipepd with Mercurial but by default is this plugin inactive. Enable it and then use:
hg purge
Try hg status. If it lists the files you copied there as unknown, all you need to do is delete them manually, as mercurial isn't tracking them anyway. Otherwise, you need to tell mercurial to forget or delete them from the repo. (e.g. hg forget foo.bar). Conversely, mercurial will not track new files until you tell it to, so if you copy files into your local repo, you need to do hg add foo.bar and then hg commit to make mercurial track them.
try:
hg remove
or look into the hg backout command
Using TortoiseHg Synchronize, clicking "Pull" pulls down the 2nd most recent revision.
At the bottom of the Synchronize interface is a button, "Update to branch tip." Clicking this button pulls down the most recent revision.
What is happening here?
Command line hg tells this:
$ hg help pull
...
Pull changes from a remote repository to a local one.
...
-R is specified). By default, this does not update the copy of the
project in the working directory.
vs.
$ hg help up
...
Update the repository's working directory to the specified
revision, or the tip of the current branch if none is specified.
If you are new to mercurial or want to know you havent missed any options, this is could be helpful:
http://blog.hanxiaogang.com/hg-guide/