Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command to set the default path in mercurial?

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?

like image 970
Erik B Avatar asked Feb 14 '11 16:02

Erik B


People also ask

What is .hg folder?

hg folder keeps track of one repo only. If you've got one in your home directory it means your home directory is under version control.

Where is HGRC?

hgrc of the user the web server runs as. As mentioned in hg help config , you have local, global, per-user, and system hgrc files. This user is second on the weekly GitLab leaderboard.


1 Answers

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.

like image 164
Ry4an Brase Avatar answered Oct 19 '22 23:10

Ry4an Brase