Mercurial: Difference between revisions
(→hg) |
|||
Line 69: | Line 69: | ||
hg cp source target |
hg cp source target |
||
hg mv source target |
hg mv source target |
||
hg oldFile NewFile |
hg mv oldFile NewFile |
||
hg project directory |
hg mv project directory |
||
== TortoiseHG == |
== TortoiseHG == |
Revision as of 10:17, 22 August 2020
Misc
hg
config file
- Windows: C:\Users\<User>\mercurial.ini
- Linux: ~/.hgrc
Username/Mail
If you are using the commandline, make sure to add to your config file:
[ui] username = John Doe <john@example.com>
aliases
mercurial command line log as one line per commit
Windows: add:
[alias] logline = log --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"
Linux: add: (the only difference to Windows is " vs '
[alias] logline = log --template '{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n'
ssh
Normally you will want to use the default OS ssh. So add the following to the config file:
[ui] ssh = ssh -C
The "-C" seems to enable compression. Not sure yet, but I keep it for now.
IF you can normally ssh to the other machine with
ssh v-rooster
then now you should be able to do a
hg -v push ssh://v-rooster/work/repo1/
or pull or clone or whatever you want to do.
You can give a name and/or port like this:
hg -v push ssh://user@v-rooster:port/work/repo1/
but it would make more sense to configure your port to connect correctly. Example under Windows 10, modify your C:\Users\<user>\.ssh\config
Host v-rooster HostName 1.2.3.4 User meaMario Port 22 IdentityFile C:\Users\<user>\.ssh\id_rsa-no-pw
paths
If you don't want to write the server and path all the time, add the following to the config file:
[paths] default = ssh://v-deb-dev2/work/src/ v-deb-dev1 = ssh://v-deb-dev1/work/src/ v-deb-dev2 = ssh://v-deb-dev2/work/src/ v-deb-dev3 = ssh://v-deb-dev3/work/src/
You guessed it, 'default' is the entry which is used, when you don't give a remote target. It is NOT necessary to have it as normal path AND default, but I like it that way.
If you want to see these with hg:
hg paths
If you clone a repository, your default is of course the source of the clone.
copy/move
use
hg cp source target hg mv source target hg mv oldFile NewFile hg mv project directory
TortoiseHG
Why does hg not work?
After you installed TortoiseHG, add the path to the install directory of TortoiseHG to the PATH variable. (Start/Settings/System/About/System Info/Advanced system settings/Environment Variables...)