Why i can't see new branch in tortoiseHG? - mercurial

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.

Related

Pushing a feature branch remotely in hg

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.

How can I move a changeset from a remotely deleted branch to another branch?

So someone deleted a remote branch, but a changeset was lost when he deleted the branch.
I have the changeset on my local repository and tried to merge the changeset to my default branch, then I pushed, but I got an error "abort: push creates new remote head 650367cd0ff4 on branch 'rc'!"
There are few options, depending on the situation you have:
If the whole branch was stripped and you have that branch locally then you can push it again:
hg push --new-branch
This is recommended, because Mercurial will anyway send your local commits to remote repo every time you will do push (until you strip these commits locally). You can then close unwanted branch with --close-branch (this will leave all commits in repo, but just mark branch as closed/unused).
hg ci --close-branch
Graft the wanted commit locally from some branch to other:
hg graft -r 123
hg push
Create new remote head ("abort: push creates new remote head 650367cd0ff4 on branch 'rc'!"). It's nothing wrong, it just means that one of your branches will have two separate top commits. These commits can be merged together later.
hg push -f

Only local branch

I want to have local branch in my cloned repository that will not exist in main repository. To do this I create branch named "new_branch", develop and commit to it. Sometimes I make commites to default branch and after that I make "push -b default" that the branch "new_branch" not appeared in main repository. After the development in "new_branch" finished I make merge to default branch and I want to make push for default branch "push -b default". I get message "abort: push creates new remote branches: new_branch! (use 'hg push --new-branch' to create new remote branches)". Can I have a only local branch in Mercurial?
You can try:
LocalBranch Extension (only Tim Lee fork seems to work with current Mercurial)
MQ (and push without --mq option)
Phases can be used for this in modern Mercurial:
# hg phase --secret -r 7::10
Will mark changes 7 through 10 as secret, as so they won't be pushed, pulled, cloned, etc.
Once you create a branch using hg branch, it is a permanent part of the changeset. It will always require you to push using the --new-branch option. You cannot strip the branch name without modifying history.
If you want give a local name to a branch that does not get propagated when you push, then you should use hg bookmark instead.

When I clone a mercurial repo I don't see changes I just made to the central repo (after a commit)

I make changes to my central repo (added files), then issue a commit. THen go to a new working repo, and issue a "clone" from central. I get everything but the files I just committed. What am I missing?
THanks.
You probably forgot to push back to the central repository
$ hg push

How to apply a collapsed revisions patch to trunk in Mercurial?

I am looking for best practices to do the following:
When I need to implement a feature or fix a bug, I am creating new Mercurial repository from the main one (a trunk).
Then, within some days, or weeks, I am implementing the task in newly created repository, making commits and periodically merging with trunk. After the code in new repository will pass all code reviews, I should provide a repository with all changes collapsed into single revision.
My common way to do this (rdiff extension should be enabled):
hg clone ~/repos/trunk ~/repos/new-collapsed
cd ~/repos/new-collapsed
hg diff ~/repos/new > new.diff
patch -p1 < new.diff
hg commit
This works almost well except when there are binary files present in the changes from ~/repos/new. Another way could be:
hg clone ~/repos/trunk ~/repos/new-collapsed
cd ~/repos/new-collapsed
hg pull ~/repos/new
hg update
hg rollback
then resolve possible conflicts and manually commit the changes
Both ways look for me somewhat ugly and non-native, so I am looking how this operation could be simplified. I've played with rebase extension, but seems its hg rebase --collapse command does not work with workflow described above.
Any ideas are welcome.
Sounds like a good case for mercurial queues.
I do something similar with the histedit extension.
My workflow is something like:
clone a central repo
commit incremental changes to local repo
clone my local repo to make collapsed repo
hg histedit and select/discard/fold the revisions as needed
hg push the collapsed repo to central repo
pull central repo to local or refresh local from scratch
I ensure that my local repo never gets pushed to the central repo by adding an invalid default-push path to the .hg/hgrc file in the local repo root directory.
Solved: Just add
[diff]
git = True
to your hgrc file, and then use my first solution with rdiff extension, replacing patch with hg import:
hg clone ~/repos/trunk ~/repos/new-collapsed
cd ~/repos/new-collapsed
hg diff ~/repos/new > new.diff
hg import new.diff
hg commit