I have a plenty of small projects served by hgwebdir and I want to configure local repos such a way I don't need to create almost similar hgrc files for every project:
[paths]
default = http:/ /myserver.com/projectN
default-push = http:/ /myserver.com/projectN
Can I use some default value like this?
[paths]
default = projectN
Environment variables won't work (win7).
You could use the schemes extension. Put something like this in your ~/.hgrc:
[extensions]
schemes =
[schemes]
my = http://myserver.com
And then your repository hgrc's can contain:
[paths]
default = my://projectN
Related
Is there a way to point to a common HgNotify configuration in each repositories' hgrc file on windows? I have the below notify section in each hgrc for every repo that I have on the server, and when I want to create a new repo, I have to copy this section into the hgrc.
[notify]
sources = serve push pull bundle
#For template, see: http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html
strip=3
template =
files:
{files}
details: {baseurl}/rev/{node|short}
branches: {branches}
changeset: {rev}:{node|short}
user: {author}
date: {date|date}
description:
{desc}
=================\n
test=false
maxdiff = 0
config=D:\hg\Repositories\HgNotify\NotificationList.txt
I am experimenting with changing the template and would like all repos to get the new template automatically.
Update: The Hg server is on windows and served thru IIS.
You can use a global hgrc file with settings for all repositories. See man hgrc.
I ended up using the %include syntax for an hgrc file, in part because the server is a Windows box and I was not sure where to put a global hgrc file that could be accessed by the IIS server/IIS user.
I put the following at the end of my hgrc files:
%include D:\Hg\HgNotify\hgrc.notify.txt
The %include actually works out great because it allowed me to put the file in an hg repo of its own so that I can have a history of changes made.
Here's what a complete hgrc file looks like in one of my repos:
[web]
name=MyRepo
contact=hg#mydomain.com
push_ssl=False
description=MyRepo
allow_archive = zip
allow_push = *
baseurl = http://hg.mydomain.net/MyRepo
logourl = http://hg.mydomain.net/
[extensions]
hgext.notify =
progress =
rebase =
[hooks]
changegroup.notify = python:hgext.notify.hook
#Include file for common notification template
%include D:\Hg\HgNotify\hgrc.notify.txt
When running Mercurial I get this error:
t3#des:gem5$ hg qnew my_p.diff
abort: no username supplied (see "hg help config")
the hg help config says:
The configuration files use a simple ini-file format. A configuration file
consists of sections, led by a "[section]" header and followed by "name =
value" entries:
[ui]
username = Firstname Lastname <firstname.lastname#example.net>
verbose = True
But where is that ini file?
hg help config
These files do not exist by default and you will have to create the
appropriate configuration files yourself: global configuration like
the username setting is typically put into
"%USERPROFILE%\mercurial.ini" or "$HOME/.hgrc" and local configuration
is put into the per-repository "/.hg/hgrc" file.
Assuming your on linux, create the .hgrc file in either your home directory or in the repository dir in question,
dirunderhgcontrol/.hg/.hgrc
Add the info(ui, username, verbose...) you stated in your question to the new file and then give it a try.
For one of my repositories, it doesn't remember the name of the repository I am pulling and pushing to. I don't have this problem with any of the other repositories on my machine. Is their any way to fix this?
In the .hg folder for the repository with a problem, create or edit hgrc and add:
[paths]
default = path\to\default\push
or from TortoiseHg (1.1.6 for me), go to the Synchronize dialog and click Configure (or just go directly to repository settings and the Synchronize item) and add an alias of "default" with the correct path for your default push/pull repository.
As of version 3.0 there is no "setting" for choosing the default URL. Instead you must create an alias of "default" for the URL that you want.
To do so, from workbench, right click on the repository and select settings. Click Edit File and add a line (see below) that specifies the default path to the desired repository.
default = URL of repository
How can I set default remote repository for mercurial local repository?
It's in the .hg/hgrc file.
[paths]
default = https://myserver/hg/repo1
default:pushurl = /home/me/mytestrepo
Is there any way of having mercurial automatically create hgrc, so that I don't have to create it every time I create a repository?
I'd like hgrc to at least contain the following:
[ui]
username = geo
Can this be done?
You can set the username in mercurial.ini or .hgrc in your Home directory and it will automatically be used for all repositories where it's not overridden by a local hgrc.
In TortoiseHg, this can be set using right-click and choosing TortoiseHg/Global Settings....
See the docs.