I enabled the largefiles extension, committed a file and pushed it. I need to permanently revert this change. How can I do it? Is there a way to make this permanent?
If you're added the file like this
$ hg add --large my-file
then Mercurial will have committed a file called .hglf/my-file to the repository (the so-called standin file) and it will have pushed my-file to the remote server when you pushed your commit.
If you disable the largefiles extension, then all there is left in your history is the .hglf/my-file file. You can delete this file like normal with
$ hg remove .hglf/my-file
The standin file will still be present in the history, just like any other file Mercurial has been tracking. But the large file (my-file) is not part of the normal Mercurial history and so you wont see it in new clones where you haven't enabled the largefiles extension.
Related
We have a large, old repository with largefiles. I want to replicate the repository to a backup server using a cron script that runs hg pull. However, this command doesn't retrieve the largefiles.
I currently have 2GB of history replicated, but I'm missing 6GB of largefiles. How can I get Hg to pull down those important files?
By default, only largefiles for the revision you update to will be downloaded.
'hg help largefiles' says:
When you pull a changeset that affects largefiles from a remote repository,
the largefiles for the changeset will by default not be pulled down. However,
when you update to such a revision, any largefiles needed by that revision are
downloaded and cached (if they have never been downloaded before). One way to
pull largefiles when pulling is thus to use --update, which will update your
working copy to the latest pulled revision (and thereby downloading any new
largefiles).
If you want to pull largefiles you don't need for update yet, then you can use
pull with the "--lfrev" option or the "hg lfpull" command.
You should be able to use 'hg lfpull --rev "all()"' for this purpose.
I've got a configuration file ("config") that we originally committed to our repository. (first mistake)
We then deleted that file using hg rm, and left a sample configuration file in the repository.
When developing, we just copy the "config.sample" file to "config". However, whenever I update to a different branch and back to the branch with the delete, the untracked config file is deleted.
I've already added the config file to .hgignore.
Is there a way to make mercurial allow the existence of this untracked file going forward?
It looks like the branch you go to before coming back contains a config file too. When updating back, the file was deleted, so mercurial removes it.
Try deleting the config file in your other branch, too, and adding the file in the .hgignore of that same branch.
How to move files (to subfolder) without losing their history?
In my Mercurial repository (I mean the folder with the .hg in it) I have MyProject/ folder with all project files. Now I need to create src/ folder inside and move all files to it (from MyProject/ to MyProject/src/). How can I do it without losing all history?
Since you have a "tortoisehg" tag, I figured I'd explain the way I do this using the GUI.
Usually, I just rename/move files in my IDE, or from windows explorer, then when I go to commit, THG will show a bunch of (?) unknown files and (R) removed files. Just right click on any of the files and choose "Detect Renames...", then click the "Find Renames" button.
You might have to adjust the "Min Similarity" slider until you get all the files you want and only the files you want, but it's usually very straightforward.
hg mv
does do the right thing, but hg log does not list entries past the move unless you
give it the -f option. See this question for more info
Why 'hg mv' (mercurial) doesn't move a file's history by default?
After you do this, you likely want to add the -f option to hg log
to the hgrc file for the repo.
.hg/hgrc
[defaults]
log = -f
In Windows with Tortoise HG installed, there is a windows shell extension that handles this very nicely.
In Windows Explorer, simply right-click and drag the file(s) you wish to move into the destination folder. You are then presented with a pop-up that give you these choices:
HG Move versioned item(s) here
HG Copy versioned item(s) here
Use hg mv to move your files and then use hg log -f (follow) to see history including renames.
I created a repository and synchronized it with a remote repository.
The files are compressed and each has an (i) extension.
I want to extract the files to a new folder (not repository) with decompressing them and with their original name as I see them on the web browsing on Google code.
Normally you do hg clone <remoteRepoPath> <localPath> to do that, which automatically updates the working directory.
Since you did an hg init and then hg pull from the remote repo, you need to do hg update and it will fill the working directory with the actual files.
All those .i files under the .hg directory are the repository's storage and indexes and such. Very rarely does anybody mess with those manually. Most of the time the only thing people touch under the .hg directory is the hgrc file and patch queues.
I have a project where I'm using Bitbucket as my HG server, but I've recently discovered that as a lone developer I can use Fogbugz/Kiln for free. I want to move my files into Kiln but I don't want to lose my history. I'm sure there's a dead-stupid easy way to do it, but I just don't know. How do I do this?
Thanks!
Create the new project repo and do the following with your current copy of the original repo: hg push new-repo-path.
Then you use the new path in the future. You can delete the bitbucket repo.
With Mercurial, all history is in every copy of the repository, including your local copies.
Since you are already using Mercurial. I was just curious, shouldn't cloning your repository on Fogbugz/Kiln be sufficient.
hg clone "BitBucket Repo ..."
Of course, this won't copy your per-repository hgrc file. You will need to do that separately.
Another approach is to use bundle.
hg bundle --all bitbucket.bundle
hg clone bitbucket.bundle my_repo
Third approach is to push or pull from bitbucket repo to fogbugz repo.
Setting defaults
See: https://www.mercurial-scm.org/wiki/TipsAndTricks.
Reproducing it here:
It is possible to store a default push URL that will be used when you type just 'hg push'. Edit hgrc and add something like:
[paths]
default-push = ssh://hg#example.com/path
The other answers have already explained that right after creating a new empty repository, you can push your changes into it with hg push http://example.com/hg/newrepo. (Note that once you have pushed some changes into it, it will only accept changes from related repositories in the future.)
What you also seem to be wondering about also is how to then configure your local repository to push to that location by default, without needing to specify the URL every time. You can do that by editing the default location in the .hg\hgrc file of your repository. It is a text file that you can open with notepad or any other text editor.