Is it possible to push from one remote repository to another remote repository?
I have a case where I push my local changes to a remote integration repos. Once approved, I want the integration repos pushed into a release repos (where I'll build my release from).
Is this technically possible?
EDIT: 1st repository is local on my disk. 2nd and 3rd are both remote repositories on my server that I DON'T have file system access to. I want to be able to push from 2nd to 3rd from my PC (using my local HG/TortoisHG client).
The simple way is to login to your server, cd to the integration repository and then push to a release repository.
If you do not have such a login, simply keep a local clone of the integration repository which you only use to locally push to a remote release repo:
$ hg clone <remote-integration-repo> integration
$ cd integration
$ hg push <remote-release-repo>
For subsequent pushes, do
$ cd integration
$ hg pull # optionally with -u option
$ hg push <remote-release-repo>
In case you have multiple integration and release repostitories, you might want to automate these steps in a script.
The basic message is that it does not really make a difference if you push to the release repo from a local or remote machine.
Depends on what you mean by "remote". If you can log into these machines and you can establish an SSH connection between them, it's easily possible.
Related
(I'm using real examples, so it is clearer.)
I cloned an official Mercurial repository locally
hg clone https://bitbucket.org/Coin3D/soqt -r default
from this repo: https://bitbucket.org/Coin3D/soqt/branch/default
Now I want to update my local copy with a commit taken from a remote fork of the main project:
https://bitbucket.org/roboticslibrary/soqt/branch/patch-hidpi
How can I integrate a specific commit from a remote fork (#214c74a in this example) into my local clone?
With git I would add the remote fork, then I would use "fetch" on that and then I would use "cherry-pick" to get the specific commit.
Is that possible at all in Mercurial?
Thanks a lot!
Is there any way to create two applications that in Openshift that use the same git repo (although perhaps different branches?).
I am basically looking for a super simple way to create one "experimental" or "dev" application and one production one.
Thanks!
This blog post on release management covers the topic in more detail:
https://blog.openshift.com/release-management-in-the-cloud/
Here's a quick summary of the process...
# setup
cd LOCAL_APP_DIRECTORY
rhc app create STG_APP_NAME CARTRIDGE_TYPE
rhc app create --no-git PROD_APP_NAME CARTRIDGE_TYPE
git remote add production -m master PROD_GIT_URL
git push -f production master
git remote rename origin staging
# deployment
git push staging # or simply, git push
git push production
# emergency rollbacks:
git log # return commit history, example hash: 28c5555352a902c549c965da30cf7559c80f328e
git push staging 28c5555352a902c549c965da30cf7559c80f328e:master
git push production 28c5555352a902c549c965da30cf7559c80f328e:master
In Git, there is the command
git remote show <remote>
When properly configured, this will show you the status of the remote compared to your local repository, including whether there are pending changes in either. I can't find a similar command in Mercurial. Am I missing something or does it just not exist?
Perhaps hg summary --remote?
To compare local and remote repositories follow these steps:
go to local repo folder (use cd path_to_local_repo)
run "hg outgoing -p path_to_remote_repo" (without quotes)
See GenerateDiffBetweenRepositories
We have two repositories: myapp and myapp-1.1. We merge myapp-1.1 into myapp.
To see if there are changes in 1.1 that need to be merged I do this:
cd c:\myapp (local clone)
hg fetch (fetch from remote myapp repo)
hg in ssh://hg/myapp-1.1 (see what needs to be merged in from remote 1.1 repo)
This works - but is there a better way? Is there a way to do this without requiring the local myapp clone?
Mercurial can't do much with remote repositories except for some variant of pushing to, or pulling from them.
As such, anything you want to ask Mercurial to do has to be done with a local clone.
So no, there is no way to have Mercurial check if two remote repositories needs to be merged.
What's the problem with having local clone, exactly?
If you want to isolate all operations on machine the repo is located, you could do the following:
$ ssh $hg_box
$ cd myapp; hg in /myapp-1.1
This may seem like the obvious response, but since Mercurial is a completely distributed source control system, and each repo is stand alone, is it possible for you to actually go to the box that has myapp and fetch directly from myapp-1.1? I know most dev teams keep some kind of centralized repository, but that doesn't preclude the use of Mercurial directly from the box that you have as your 'central' repository. It's all still local and remote repositories.
This assumes that you want to fully merge myapp and myapp1.1. Otherwise, pretty much by definition of what you're doing, you have to clone myapp to another full repository, then merge it with myapp-1.1.
Assuming neither the remote repo nor the local repo allows multiple heads per branch, this command should tell if the local repo has the head of the remote repo at a given branch:
hg log -r $( hg in -b branch_name -n -l1 -q --template "{node}\n" )
If local repo doesn't have that changeset, but has outgoing changesets at "branch_name", then typically it should be an indicator that merge is needed.
Found myself quite confused today about this.
I create a blank repository locally(hg init), cloned it to working copy, added some code, commited and pushed it(to local repo obviously).
Now I need to share that repository with others. There is a server that has mercurial on it, how do I clone my repository to a remote one such that other developers can access it and pull/push code from/to it?
You'll want to check out the publishing repositories wiki page to get into web interfaces and access controls, but at it's most basic you can do something like this:
hg clone yourlocalrepo ssh://you#server//home/you/repo
That clones your local repo to a remote location of your choosing. Note that there are two double slashes in that URL.
You can't create a remote repo like that using http://, only ssh://. If all you have is http to hgweb.cgi you can 'hg init' an empty repo on the server and then hg push to it.
If your "official" repositories are served up by an HTTP server, and you want to create a repo in the central location based on a local machine's repo, here's one way. You need admin rights on the central server to do this.
e.g. I'm developing on windows, and my central repository is running on linux and served by lighttpd per the official guide. The server's central repo directory is /var/hg/repos/, owned by the user/group www-data. My local machine's IP is 10.1.10.100, and the repository I want to clone is named foo.
On the local machine, open a command prompt into the repository directory and type hg serve. This runs the local hg web server, which will allow the server to pull from it.
ssh into the central repo server, logging in as a user with sudo rights to www-data.
cd /var/hg/repos
sudo -u www-data hg clone http://10.1.10.100 foo
For those that come later and don't want to bother about the hassles of ssh for pushing changes to a server built to host repos, you can just init on the server, and then push as you do every other repo.
# on server:
cd repos/
mkdir myrepo
cd myrepo
hg init
cd ..
chown -R apache:apache myrepo
cd ..
vim hgweb.config
# change [paths]
[paths]
myrepo = /path/to/myrepo
# on your machine
# make sure you've configured hgrc correctly
[paths]
default = http://server/hg/repos/myrepo
hg push
# ???
# profit