I have a local repository and it's clone on my PC (windows). Is there any way I can perform an auto update on master repository after I push changes to it from the clone?
You can add a changegroup-hook in the master repository:
$EDITOR /master/repository/.hg/hgrc
[hooks]
changegroup = hg update
This will perform an update whenever something is pushed into the master repository.
Related
I cloned an hg repo and created a feature branch (via hg branch myfeature). I have staged & committed changes to it via hg add . and then subsequently hg commit -m "My new feature branch.".
I would now like to push those changes (in the branch; not as default) to the remote server (where I cloned the project from) so that other devs can code review the changes in the myfeature branch.
I found a blog that recommends using:
hg push --create-branch-remote
But this isn't working for me - any ideas where I'm going awry?
You forgot to read hg help push for your version of Mercurial
...
--new-branch allow pushing a new branch
...
Looks like --new-branch is what I wanted.
I create a new branch and commit it. But my team can't see this branch in their tortoise, why?
It sounds like you only committed to your local clone of the repository. You have to hg push the commit to the remote repository you originally cloned, if that is the repository the teammate is cloning.
I have three Mercurial repositories repo, repoA and repoB. I'd like the following happen
some edits in repoA
commit to repoA
push manually to repo
repo updates and pushes to repoB automatically as soon as it receives commits from repoA
How about using Mercurial hooks?
For instance:
[hooks]
changegroup = hg up; hg push repoB
If you're on Windows, the hook command-line would be instead hg up & hg push repoB.
(note that for more complex stuff, you can instead just call a Bash/Cmd script instead of one-liner like this)
I just lost my .hg* files for my repository after a migration and I have made a bunch of unpushed changes to some code.
I need to Init a new repository and then push my changes to an existing remote repository. Do I just need to init a new repo and then specify the remote repo in the hgrc and push? Thanks!
If you remember the changeset you had in your original repo as its working parent (let's call it A), then you can do this:
$ hg clone http://server/upstream newrepo
$ cd newrepo
$ hg up A
Then copy the working copy of the original repo to the new repo (with an additional precaution of deleting all files from the new repo if you renamed / deleted anything in the old repo). Afterwards, commit and push from the new repo:
$ hg commit
$ hg push
If the upstream repo has anything on top of A, rebase or merge before pushing.
I've forked a Mercurial repository, and now I want to pull the changes from the main repository into my fork. If this were git, I would do something like...
git remote add upstream <url>
git pull upstream master
How do I do this sort of thing in Mercurial?
You could also modify your hgrc file in your repo
default = ssh://hg#bitbucket.org/<my_user>/<my_repo>
upstream = ssh://hg#bitbucket.org/<other_user>/<other_repo>
Then you can do
hg pull upstream
If you cloned the repository from the one you want to pull changes from, you can simply do:
hg pull
If you cloned the repository from another repository, you can:
hg pull <location of repository to pull from>
You'll then need to update your working copy:
hg update
That's the basics, anyway. More details are available in the Mercurial: The Definitive Guide
Have you tried the pull command?
hg pull http://master.com/master
If that does not work, please elaborate.
You could also modify your hgrc file in your repo to use the special path names default and default-push.
default-push = ssh://hg#bitbucket.org/<my_user>/<my_repo>
default = ssh://hg#bitbucket.org/<other_user>/<other_repo>
Then you can pull from upstream (aka default) with
hg pull
and push to fork (aka default-push) with
hg push