Changing Mercurial "Default" Parent URL

28,370

Solution 1

You can even add multiple entries in the [paths] section of your .hg/hgrc file.

[paths]
default = /repo_store/hg/project1
sandbox = /repo_store/hg/project1_experimental

And then can specify its alias in the mercurial commands. default repo need not be specified but others have to be like,

hg in            # check incoming changes from default repo
hg in default    # check incoming changes from default repo
hg in sandbox    # check incoming changes from sandbox repo
hg pull sandbox  # pull changes from sandbox repo

Solution 2

I just found the answer to my own question. Edit the .hg/hgrc file in the repository, change the default setting under the [paths] section. Simple!

Solution 3

Example of setting default BitBucket repository for Mercurial push and pull.

Normally we can use

$ hg push https://bitbucket.org/username/com.example.app

But if we want to use $ hg push without the repository URL we must add the URL to the file $REPO/.hg/hgrc. We add the following contents:

[paths]
default = https://bitbucket.org/username/com.example.app

Regarding your question, just set the default path to new URL.

Share:
28,370
Adam Ernst
Author by

Adam Ernst

I'm an iOS developer based in New York City. I made one of the first 500 apps on the App Store with iTrans, my NYC subway app. I did the Khan Academy iPad app and the Turntable.fm iPhone app. Now I blog and work at Facebook on their iOS app.

Updated on July 13, 2020

Comments

  • Adam Ernst
    Adam Ernst almost 4 years

    Let's say I have a Mercurial repository and I'm pulling from a default parent URL (the source I cloned it from).

    Now I want to change the default parent URL (hostname change, or it was copied to another machine, etc.). Is there a way to do this, or do I have to re-clone from the new URL?