By default on Windows XP Mercurial stores the .hgrc file in (well, in my case) c:\Documents and Settings\srooks\. How can I change that location, and have it look for .hgrc file in, for example, c:\Configuration_Files ?
Can it be done at all?
Set up the HGRCPATH environment variable with the path to the configuration file.
You can move file to c:\Configuration_Files and create link to it in "Documents And Settings" folder. See mklink command.
Related
I am using Git Command Line, Homestead, Windows 10, PhpStorm 2017.3.
I want to open any project in PhpStorm using git bash /command line.
Just pass FULL path to the project root folder as parameter to PhpStorm executable file -- IDE will either open existing project (if .idea subfolder exist) or will create brand new project from those files.
It works the same as if you would use Open from within PhpStorm and point to such folder.
An example:
"C:\Program Files\JetBrains\PhpStorm\bin\phpstorm64.exe" "C:\Projects\MyProject"
phpstorm64.exe is for 64-bit Java
For 32-bit Java you should use phpstorm.exe
You can add path to PhpStorm executable into system's PATH variable so there will be no need to use the full path. But then you have to install new versions into the same folder or update PATH as needed. The you could just use phpstorm64.exe "C:\Projects\MyProject".
You can also create some alias/batch file (similar idea to what Mac/Linux user have -- there IDE creates that for them) so it's easier to use. It's a bit more initial work but easier to keep the path up to date.
You may want to specify another path for your program but if nothing else just use this I guess.
How can I open the hg in the command prompt in any directory?
I have tried setting classpath. But nothing works..
I need to use Hg like below picture wherever am in the directory.
You must have path to C:\Program Files\TortoiseHg\ in your PATH variable
Open Control Panel -> System -> Advanced System Settings -> Advanced Tab -> Environment Variables
Make sure that under PATH variable you have C:\Program Files\TortoiseHg\ included
In TortoiseHg Workbench open the repository and start a terminal window with Ctrl-Shift-T.
I am trying to go though this tutorial that says:
Enable SSH compression for Mercurial
Edit the Mercurial global configuration file (~/.hgrc).
Add the following line to the UI section:
ssh = ssh -C
But there is no that file in my system. HG of course is installed.
It is not there by default. You don't need it to exist — it just can exist to customize how you use Mercurial. You just need to create a .hgrc file in your home directory and it should work.
Heres a great intro post:
http://hgtip.com/tips/beginner/2009-09-30-configuring-mercurial
Snagged from the manpages at https://www.selenic.com/mercurial/hgrc.5.html.
Files
Mercurial reads configuration data from several files, if they exist.
These files do not exist by default and you will have to create the
appropriate configuration files yourself:
Local configuration is put into the per-repository /.hg/hgrc
file.
Global configuration like the username setting is typically put into:
%USERPROFILE%\mercurial.ini
$HOME/.hgrc
The names of these files depend on the system on which Mercurial is
installed. *.rc files from a single directory are read in alphabetical
order, later ones overriding earlier ones. Where multiple paths are
given below, settings from earlier paths override later ones.
On Unix, the following files are consulted:
/.hg/hgrc (per-repository)
$HOME/.hgrc (per-user)
/etc/mercurial/hgrc (per-installation)
/etc/mercurial/hgrc.d/*.rc (per-installation)
/etc/mercurial/hgrc (per-system)
/etc/mercurial/hgrc.d/*.rc (per-system)
/default.d/*.rc (defaults)
On Windows, the following files are consulted:
/.hg/hgrc (per-repository)
%USERPROFILE%.hgrc (per-user)
%USERPROFILE%\Mercurial.ini (per-user)
%HOME%.hgrc (per-user)
%HOME%\Mercurial.ini (per-user)
HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial (per-installation)
\hgrc.d*.rc (per-installation)
\Mercurial.ini (per-installation)
/default.d/*.rc (defaults)
For up-to-date versions of mercurial, you should use the XDG compatible location. Unless you explicitly set XDG_CONFIG_HOME the settings should go into the file:
~/.config/hg/hgrc
Less clutter in your home directory and ~/.config/hg/ can also be used for files like a common hgignore
Let's say I have a tarball of all my vim config - everything normally inside ~/.vim (plugins, autoload, colours, all that stuff), and a vimrc file. I extract this to a directory somewhere. So in the directory where I am ($PWD), there is a "vim" folder and a "vimrc" file. (note: this directory will be read-only, so vim shouldn't try to write into it).
What command-line arguments or environment variables can I give to vim to ensure that all my plugins, syntax, etc is loaded as well as the vimrc, in the same order as they normally would if they were located in ~/.vim and ~/.vimrc
As a bonus, I'd like to ignore the host computer's ~/.vimrc and ~/.vim if possible (but this is not mandatory).
If you're wondering why I don't just chuck the files in ~/.vimrc and ~/,vim, I'm trying to package up my own vim configuration and take it with me. I don't want to clobber the vim config of the computer I'm using, I just want to start a vim session with my config.
I have a portable .vim folder exactly as you described, this is how I have set it up:
Put your portable .vimrc file inside your .vim folder.
Add the following lines to the start of your portable .vim/.vimrc:
" set default 'runtimepath' (without ~/.vim folders)
let &runtimepath = printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM)
" what is the name of the directory containing this file?
let s:portable = expand('<sfile>:p:h')
" add the directory to 'runtimepath'
let &runtimepath = printf('%s,%s,%s/after', s:portable, &runtimepath, s:portable)
Start vim by using: vim -u /path/to/portable/vim/.vimrc.
On Unix & Linux systems (and maybe Windows) Vim uses the $HOME environment variable to locate the .vimrc file and .vim directory. So you can cd into the directory where you have your custom versions and start vim or gvim like this:
HOME=. vim files....
This "vimrc File and Vim Runtime Directories" screencast might be useful, as well as the vim documentation for 'runtimepath', which states the following:
This is a list of directories which will be searched for runtime files:
filetype.vim filetypes by file name |new-filetype|
scripts.vim filetypes by file contents |new-filetype-scripts|
autoload/ automatically loaded scripts |autoload-functions|
colors/ color scheme files |:colorscheme|
compiler/ compiler files |:compiler|
doc/ documentation |write-local-help|
ftplugin/ filetype plugins |write-filetype-plugin|
indent/ indent scripts |indent-expression|
keymap/ key mapping files |mbyte-keymap|
lang/ menu translations |:menutrans|
menu.vim GUI menus |menu.vim|
plugin/ plugin scripts |write-plugin|
print/ files for printing |postscript-print-encoding|
spell/ spell checking files |spell|
syntax/ syntax files |mysyntaxfile|
tutor/ files for vimtutor |tutor|
And any other file searched for with the |:runtime| command.
The defaults for most systems are setup to search five locations:
1. In your home directory, for your personal preferences.
2. In a system-wide Vim directory, for preferences from the system
administrator.
3. In $VIMRUNTIME, for files distributed with Vim.
*after-directory*
4. In the "after" directory in the system-wide Vim directory. This is
for the system administrator to overrule or add to the distributed
defaults (rarely needed)
5. In the "after" directory in your home directory. This is for
personal preferences to overrule or add to the distributed defaults
or system-wide settings (rarely needed).
My solution isn't quite the same but could be adapted pretty easily.
I have my Vim setup on my workstation and it's shared through regular Windows file sharing. I have this batch file that I can launch from any other computer in the building (and there's an install of Vim on another network share since most workstations don't even have Vim installed). I just run this batch file and am in my happy place.
set MYWORK=\\my_pc\work
set RCBASE=%MYWORK%\personal\utilities\tom.
start \\server\software\vim\vim73\gvim.exe -u %RCBASE%vimrc -U %RCBASE%gvimrc
So basically the adaptation would put the batch file, shell script, or otherwise into the archive you're unpacking and launch the system vim with your local files.
Problem on WindowsXP (likely will happen on all Win installs), first time using Mercurial. I found the answer in an inobvious place so I'm asking/answering the question myself so others don't have to search like I did.
First time using Mercurial on machine.
Add new repoz:
c:\bla\>hg add
no problem.
Next, commit:
c:\bla\hg commit
error:
abort: no username supplied (see "hg help config")
Solution:
On my Windows install, the Mercurial.ini did not get propagated. It also needs a user email added to it.
Take the default Mercurial.ini file found at in the Mercurial executable install directory (C:\Program Files\Mercurial\Mercurial.ini on my machine)
and copy it to your user home dir (C:\Documents and Settings\myName on winXP).
On a Windows 7 install there is no default .ini, you will need to create a new one in C:\Users\myName.
Then edit that .ini file. Find this area. The username needs an email set. It will be blank--add your email name here.
[ui]
; editor used to enter commit logs, etc. Most text editors will work.
editor = notepad
username = userEmail#domain.example
This fixed the problem for me.
I'm sorry, but why do you call this a problem? Mercurial asks you to see hg help config, and this help text explicitly tells you how to add a username -- I know since I wrote that help text :-)
How should we improve the error message to make this more clear?
However, we've managed to screw this up by making hg help config include help for all config settings. So the nice little example of how to set the username:
[ui]
username = Your Name <your#email.example>
is now lost in the noise (add this to ~/.hgrc, creating the file if necessary). I've opened an issue for this.
On Windows XP I do not see an ini file.
After creating the repository using the command hg init,
I added a file with the name hgrc to the folder .hg
With the following content:
[ui]
editor = notepad
username = zamboni#icemachine.example
no matter Windows or Linux, hg looks the <repo>/.hg/hgrc file for valid configuration. As in "hg help config" says, you only have to add at the end of that file the following lines:
[ui]
username = YOUR NAME <EMAIL#HOST.EXAMPLE>
verbose = true
save and hg commit -m 'test'
If you are using TortoiseHg, you can add [UI] settings easily
Right clicking in any folder Explorer to access the TortoiseHg menu.
From the flyout TortoiseHg menu choose Global Settings
From the interface click the Edit File
Add the [UI] settings to the end
[ui]
username = YourName <YourEmail#SomeAddress.com>
verbose = true
Save and you are done
Here is what worked like a charm for me on Windows XP:
Go to the folder C:\Program Files\Mercurial\hgrc.d assuming you have installed Mercurial to C:\Program Files\Mercurial\.
You should see a Mercurial.RC file in there.
Copy the file to C:\Documents and Settings\ [USERNAME]\
Rename Mercurial.RC to Mercurial.ini.
Edit the [ui] section like so:
[ui]
; editor used to enter commit logs, etc. Most text editors will work.
editor = notepad
verbose = True
username = userEmail#domain.example
I had the same problem. What helped me was to put [ui] and username = firstname lastname on separate lines of the ~/.hgrc file. Putting these two things on one line did not work and led to the error.
This problem still exists. The mercurial.ini file is ignored no matter where you put it.
No mercurial.ini file is created during installation. I created one in the Mercurial install directory, but it had no effect. I copied it to %USERPROFILE% and then to %HOME%, but neither one works.
Putting .hgrc in the HOME directory works.
The documentation ("hg help config") needs to be fixed.
Configure you .hgrc like this:
[ui]
username = your name <youremail#host.example>
verbose = True
NOTE! Do not leave out the [ui] part
This is a problem because in the help file the path to the specified config file does not exist, we have to copy the Mercurial.ini from program files directory to USER directory, maybe this is a problem coming from the installer on windows.
#Kevin Won: you forgot to add the line:
verbose = True