Rename a committed branch - mercurial

how to rename a committed branch in tortoise Hg workbench?

Related

How to use hg to back branch?

I have local branch and master branch. I use hg merge local branch with master branch, after that I find that master branch version is modified and I have to merge with new master branch.
I don't know how to back local branch status and merge new master branch.
If you committed the merge and then found that there were new changesets on master, you could do either of:
hg pull the new changesets, then hg merge again, then push the two merges.
hg strip your merge, then hg pull and hg merge <localbranch> again.
If you haven't committed first merge yet, you could hg update default -C to throw out the merge changes, then hg pull and hg merge <localbranch> again.

Branches in Git vs Mercurial

How do I return to a certain changeset (or tag) and branch out from that commit?
Once I branch out and committed changes won't affect the original branch?
|
tag-----------------
| \
branch-1 branch-2
hg update branch-1
hg branch branch-2
edit
hg commit
Note that this is named branches and there are other ways to branch in Mercurial.

Add to rename tracking in mercurial after commit

Simple scenario:
I have renamed a file. The changes are committed and pushed. I didn't have used hg rename.
How can I tell mercurial that an add/remove in a commit was a rename? Is there something like the svn .mergeinfo that I can edit manually?
(It is not the last commit, so solution with amending to a commit are nice, but won't help me.)
You could try the following:
hg update to the commit before the file was renamed.
Do an hg rename to the new filename, and ensure the contents of the file are the same as on the main branch.
hg commit.
hg update to the main branch.
hg merge --tool internal:other the new branch into the main branch.
From the merged commit onwards Mercurial should know about the rename.

Putting changesets into a new branch in Mercurial

I'm having the following problem: I commited two changesets into the default branch, but now I think I should put them into a new branch. That means I want to branch of from the revision before these changes happened, put those changesets into the newly created branch and erase them from the default branch's history.
What's the best way to do this in Mercurial?
hg rebase can probably do that.
Otherwise you can do it manually:
hg clone -r <previous rev> old new
cd new
hg branch <branchname>
hg export -R ../old <first cset> |hg import
hg export -R ../old <second cset> |hg import

Correct way to jump back and forth between two branches?

If I create a branch:
hg branch branch-A
and commit to it:
hg commit -m "improvement A-1"
and then create a second branch:
hg branch branch-B
and commit to it:
hg commit -m "improvement B-1"
If I want to add my next change to branch-A do I simply type:
hg branch branch-A
and commit to it as before:
hg commit -m "improvement A-2"
hg branch
always creates a branch (although it warns you if the branch already exists.) To switch to an existing branch, either
hg update -r <some revision in that branch>
or
hg update <that branch>
will switch to that branch.