replicate Hg repo with all largefiles - mercurial

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.

Related

How do i undo the hg pull and update?

I am working in branch A and am using eclipse mercurial plugin to manage version control.Mistakely while pulling and updating the changes from the remote repository I pulled and updated changes of all the branches of my project.Now my branch A has changes of other branches say B , C , D .. as well.
I go-ogled and found out that hg rollback is likely the solution however I am not sure.
How do i undo my last pull and update? Any suggestion would be appreciated.
For a direct hands on How to revert a Mercurial hg pull?. Also look the Mercurial FAQ (7.13).
The hg update is never a problem, just do hg update YOUR_LOVED_REVISION_NUMBER and your working directory is again with all your stuff, and only your stuff.
Assuming you and only you works in the A branch, the hg pull is either a problem, just other's work in other's branches in your backstaged Mercurial internal history. If you like your history (DAG) clean then you may hg strip those annoying branches in your local repository.
Assuming the A branch is co-worked, then the hg pull just imported the other's work to your local copy of the project.

How to do a quick push with Mercurial

After a change in my local repo, I commit with hg commit -m <message>, then I push to my server with hg push, then in my server I update working dir with hg update.
Is there a better way to do this?
The first two steps you have described:
hg commit -m <message>
hg push
are required as per the fact that commits are kept completely separate from the server in Mercurial (and most other DVCS as well). You could write a post-commit hook to perform the push after each commit, but this is not advised because it prevents you from correcting simple mistakes during the commit and before the push.
Because you're trying to perform an update on 'the server' I'm assuming you are executing a version of the code in your repository on the server. I'm assuming this because typically the server would simply act as a master repository for you and your developers to access (and also to be subject to backups, etc..), and would not need the explicit hg update.
Assuming you are executing code on the server, you can try and replace the push and the update with this command:
hg pull <path to development repo> -u
which will perform a pull from your local repo and then an automatic update. Depending on your server configuration, it might be difficult to get the path to your local repo.
For the first part of the question (ie. automatically push when you do a commit), you can use the trick described in this answer : mercurial automatic push on every commit .
If you want to automatically update the working directory, you can do this with a hook. Add this in the hgrc of your repository (.hg/hgrc on your server directory) :
[hooks]
changegroup = hg update >&2
This will automatically update the working directory every time a push is made to this server. This hook is described in the Mercurial FAQ.
If you use these 2 solutions, the next time you do hg commit -m "message", the commit will be automatically pushed to the remote server and the working directory on the server will be updated.
There is an extension called autosync you might find useful:
This extension provides the autosync command which automatically and continuously commits working copy changes, fetches (pull, merge, commit) changes from another repository and pushes local changes back to the other repository. Think of configuration files or to-do lists as examples for things to synchronize. On a higher level the autosync command not only synchronizes repositories but working copies. A central repository (usually without a working copy) must be used as synchronization hub:

TortoiseHG Update Remote Repository

I have recently added several projects to an existing repository on my local dev box. I periodically synchronize the local repository to a network drive repository. However, the new projects do not automatically show up on the network repo---only the ones that were there when I performed the initial clone.
How do I get the new projects into my network repo?
You use the 'hg push' command to push changesets from local to remote and use 'hg pull' to pull changesets from remote to local.
Moving the changesets over is sufficient to get the contents there, but if you want to see them in the working directory you hg update.
Also it sounds like you have multiple projects in a single repo. That's the normal setup in subversion, but in Mercurial or git you want separate repositories per project. It's better that way because all changesets/commits span the entire repo and it's not possible to hg update or hg clone only a portion of the repo like it is with svn.

Mercurial bulk delete

I've just recently moved a lot of my Views and Controllers into more appropriate locations and am now wanting to pull down recent changes from our central repo.
I've done a hg pull which worked fine and asked me to do a hg update to bring the changes down locally. This in turn informed me that I needed to do a hg merge however when I try this, I get a message stating that
abort: outstanding uncommitted changes
When I check this using hg status I see in the list all of the files that I've moved (so they're now deleted from their old location).
How do I tell Mercurial that I've removed these files? Do I have to go through each one of them and manually do a remove? Is this something that's possible using only the command line rather than doing it with a GUI tool?
From the command line to automatically hg rm the files you've removed you'd:
hg addremove
It's likely your GUI (you didn't say which you use) exposes that functionality too.
However, that's not what's causing your message. You have some already made local changes that mercurial does know about (unlike the removed files which it doesn't know about until you tell it), and you need a hg commit before you can merge.

Correct command to retrieve remote mercurial updates pushed from my second machine

I'm new to Mercurial.
I initialized a Mercurial project on Machine A, committed my changes and uploaded them to a remote repository.
Then I cloned that repository on Machine B, committed some additional changes and uploaded them to the same remote repository.
In both cases, I uploaded the changes with the same command:
hg push https://username:password#domain/user/repository/
Now I'm back on Machine A and I'm not sure how to update my local repository with the last changes I uploaded to the remote repository from Machine B.
The commands hg clone or hg pull look like they might work but I'm not sure.
Would appreciate any guidance. Thanks.
hg pull will transfer any remote changesets not present in your local repo. Afterwards, you'll need to either hg update or hg merge depending on the presence of local changes.
Use hg pull; pull transfers only changesets which are missing in the existing destination repository.
hg clone creates local copy of a remote repository.
See also this so question.