I want to keep Mercurial servers at four different locations, and want them to be identical at any given time. Meaning, any change to any of them must be propagated to all other servers. How to do that?
You can add an action on the server with an incoming hook.
Hooks allow you to automate tasks when events happen on the repository. Whenever you get a push into the repository, you can push to your mirrors as well.
More on hooks: http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html
Related
I have a JSON (multiline) file with lots of project settings and a list of included modules for a few projects. It's version-controlled by git with the same repository as my projects. It is constantly growing and works just fine to set up and tune my projects. The only problem is, when working with team and branches I constantly have merge conflicts that need to be solved manually, and 99% of cases is "use both" because it's just new entries. So what are the alternatives? I need to have the same version and branching in this database since it has project settings and dependencies, but I want to reduce conflicts to a minimum. And I do not want a separate database, that I need to maintain in parallel with git, they need to perfectly sync automatically when switching between different branches or commits. Thanks!
My scenario:
A set of shared repositories needs to be locked for a given time so a process can run for a given time. After this process is done, I want to unlock the repositories. It's a process not on the repositories, but on a different system.
The repositories are not what the process is working on. I just need a time frame where the repositories are "protected". I just need to make sure the repositories don't change while this process is running.
I want a simple way to lock a repository, so no one can push to it.
If I manually create a .hg/store/lock file with a dummy content, do you see any problem with it?
Initial testing shows it works, but I'm concerned that I might not be aware of the implications.
If you just need to generally deny access to the repos for a given period, then you can do it that way. There shouldn't be any side-effects or other consequences.
Clone the repository and then run your process against the cloned repo.
I was wondering what ways are are there to sync web projects initialized with git and mysql databases between 2 computers without using a 3rd one as a "server".
I already know that I could use a service like Dropbox and sync data with it, but I don't what to do it so.
If the two servers aren't always available (in particular not available at the same time), then you need an external third-party source for your synchronization.
One solution for git repo is to use git bundle which allows to create a kind of "bare repo" in one file.
Having only one file to move around make it any sync operation easier to do.
You will have to copy a bundle from one server to another (by whatever mean you want), in order for the second repo (on the second server) to pull from (you can pull from a git bundle: it acts as a bare repo) that bundle.
Just clone from one to the other. In git, there is no real difference between server repos and local repos in terms of pulling and cloning. Pushing from one to the other is tricky if neither is created as bare. Generally in that case, rather than push one from the other, we'll pull back and forth as needed.
I'm setting up multiple Mercurial repositories for all of our different projects, probably close to 50. Is there a way to search across multiple repos for a specific file or string? For example, say that a database column is renamed, how would I search each repository for any reference to the old column name? I know that I can do this for each repository individually, but if you've got 50 repositories, that can be quite time consuming?
If it's not possible, are there any best practices then for structuring your repositories to minimize this pain?
It's not possible -- repositories are entirely independent.
If you wanted to set up a global search one way to do it would be to push all your 50 repositories into a single repository that can be searched. Something like this:
hg init everything
for therepo in /path/to/repos/* ; do
hg -R everything pull -f $therepo
done
Then you can search in everything. You could keep everything current using a cron job or changegroup hooks on your other repos that do a push to everything.
If I want to set up a smallish Mercurial repository for some internal work among a few developers, can I just navigate to a network share and create a repository there, and then just clone that down locally? Or do I need to set up a server (I know, it's easy to do).
This is Windows by the way.
Specifically, I'm wondering if there will be concurrency issues, like abandoned transactions, etc. if multiple users work push/pull simultaneously.
So long as folks are interacting with the repo using only 'clone', 'push', and 'pull', you're in fine shape. What you can't do is have multiple people committing directly from a shared working directory. However, push, pull, and clone are safe to use to a shared folder from a user's personal repository. All changes end up effectively atomic, and no aborted work should cause anyone any problems.
When creating that clone consider using clone -U so it's created without a working directory so folks aren't tempted to edit and commit there.
There's no reason I can think of why you wouldn't be able to do so. I do something similar, only I don't use CIFS, but ssh to access the files. No server setup to speak of in either case.
The only thing that came to mind as a possible problem was concurrent access, but you can see for yourself that Mercurial takes care not to allow users to step on each other's toes.