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
Related
I have main repository and 12 subrepositories in it. .hgsub contains mappings of local paths and repository hosting URLs. Besides default pull/push URLs for subrepositories, I need to be able to push each subrepository to another server as a standalone repository. So, I add new path alias in .hg/hgrc of each subrepository.
The problem is that aliases are not save anywhere except my local machine, so when I do clean clone of main repository, this aliases are gone and I need to setup them again.
Can I permanently save this path aliases in repository configuration file or maybe there's some workaround for this?
I think the best option available to you is to keep a .hgrc snippet in place in the parent repository filled with [subpaths] entries. For example create subpaths.hgrc as a tracked file in your repository:
[subpaths]
repoa = http://remote/path/to/repo/a
repob = http://remote/path/to/repo/b
Then when you want to initialize those repositories you add this line to your clone's .hg/hgrc:
%include ../subpaths.hgrc
and then comment it out when you want the repoa and repob paths being their usual, local selves.
Currently we are using http:// only for readonly access and devs have to change the repository adress to use ssh://hguser#... in order to be able to push.
Is it possible to enable push and still identify users based on SSL keys. Alternatives?
Mercurial provides for two default paths in configuration files. You can define a default-push path that is used for push operations while default is used for pull operations. So, in your repository .hg/hgrc file, you can add something like:
[paths]
default = http://...
default-push = ssh://...
See hg help paths for more info.
#votingmeisfree, the projrc extension may help you take care of this configuration without each developer having to.
I can set my usual email address in my ~/.hgrc file, but is there a way to specify that for one hg project I want to be known as a different name/email (similar to git's .git/config file in the project directory overriding the ~/.gitconfig settings)?
You can create a <repo>/.hg/hgrc file which will override settings in your ~/.hgrc.
See hg help config for more details.
My understanding: Mercurial has three levels of config files: one shared by all users (installation level), an overriding one for each user (user level) and an overriding one for each repository (repo level).
The HGRCPATH environment variable appears to override the second level, the one found in the users/<user> directory in Windows.
However in TortoiseHG's settings screen, it refers to (and allows direct edit of) the user level config file in the users/<user> directory, even when overridden by HGRCPATH. Quick experimentation has shown that TortoiseHG indeed uses the one set by HGRCPATH, not the one it indicates.
Is this a bug with Tortoise or is my understanding of HGRCPATH flawed?
Yes, this must be a flaw in TortoiseHg. The hg help environment help text says that HGRCPATH is used to override the default search path for configuration files. This includes ~/.hgrc and lets you quickly disable your user settings:
$ HGRCPATH= hg log # <- only read .hg/hgrc, ignore all other config files
You cannot make Mercurial skip reading .hg/hgrc.
The description in the Mercurial manpage makes it sound like if HGRCPATH is set then both the system-wide file (/etc/mercurial/hgrc on linux) and per-user file are ignored, but that the $(hg root)/.hg/hgrc file is still consulted. That's been my experience outside of tortoisehg.
I wouldn't expect the tortoisehg GUI to not-show the hgrc commands its not invoking, just to not take in their settings. Is that what you're seeing?
http://www.selenic.com/mercurial/hg.1.html
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.