Question

Good Day,

I have a sample project that I'm developing using Mercurial Hg. It's a sample project that resides at:

C:\Development\Serivce

The default branch points to this location. I created a Named Branch called TestBranch at this same location. I made some changes to default that I want to push to TestBranch to familiarize myself with how Mercurial does branching.

When I switch to the default branch using "hg checkout default", I try executing the command "hg push TestBranch" and I received the following output:

C:\Development\Service>hg push TestBranch
pushing to C:\Development\Service
waiting for lock on repository C:\Development\Service held by 'dev-pc:4124'
interrupted!

C:\Development\Service>I hit Ctrl-C a minute later.

The question is how can I push my changes from default to TestBranch?

I'm learning more about the various ways to branch in Mercurial. Some dev's don't like the Named Branch approach because it's not a best practice for short-lived projects. This will be an ongoing project. Luckily for me, this sample project resides on my local machine and will not affect the rest of my team.

Was it helpful?

Solution

The hg push TestBranch is not doing what you expect it to do. It is not pushing a branch, but instead pushing TO the repo TestBranch, which most certainly does not exist.

The command to push ONLY TestBranch is this one:

hg push -b TestBranch

However, issuing a simple hg push would work too. Without the -b TestBranch (or -r TestBranch), you are pushing all the changesets that are not present on the remote repo, including the branch you created.

Now, for your lock, you are actually pushing to the same repo you originate your push from. That most certainly end up as a deadlock.

C:\Development\Service>hg push TestBranch
pushing to C:\Development\Service

Instead, if you are conducting tests, create a clone of your repo elsewhere on your PC and push to it.

hg push -b TestBranch c:\Development\Service-clone
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top