Reputation: 42584
hg clone
sets up the default path, so that you can pull and push without specifying the url every time.
hg clone ssh://[email protected]/account/repository
But if you have an existing local repository and decide to share it on bitbucket, you won't get the default path setup for you.
hg push ssh://[email protected]/account/repository
Is there a command to set the default path or am I forced to manually edit .hg/hgrc?
Upvotes: 20
Views: 10726
Reputation: 78340
There isn't a command for this and there won't be one. One of the times this was suggested the primary author of Mercurial, Matt, tweeted:
What is it with coders who are intimidated by text-based config files? Like doctors that can't stand blood.
You can make the hg erc
command open up that editor by putting this in your personal .hgrc
:
[alias]
erc = !$EDITOR `$HG root`/.hg/hgrc
(that last from Steve Losh)
If you want to get fancy you could do a post-clone
hook that modifies the .hg\hgrc
file using sed or similar, but you'll not find that functionality in Mercurial any time soon.
Upvotes: 20
Reputation: 4146
If you're running TortoiseHg, you can also bring up the Repository Explorer and select Synchronize->Configure Paths... this will allow you to define the default path, and any additional paths you may want. For example, you could configure a path with the alias 'bitbucket' and use your default path for a local clone, server copy, etc...
Changes made in this fashion are not stored in the .hgrc or Mercurial.ini file because they are per repo - they are instead stored in the .hg directory.
Upvotes: 6
Reputation: 89937
No, there's no builtin command; you need to add it in .hg/hgrc yourself.
Upvotes: 6