I need to know if i it is possible to add in my hgrc file something like this:
[paths]
default = http://somehost.com/repos/
live = ssh://user#host.com//home/user/public_html
I read some information about this in http://www.selenic.com/mercurial/hgrc.5.html#paths
But my problem is that i don't know how to use it.
My guess is that it should be something like this:
hg pull #live
Maybe i'm missing some documentation.
Thanks
From hg help urls:
URLs can all be stored in your
configuration file with path aliases
under the [paths] section like so:
[paths]
alias1 = URL1
alias2 = URL2
...
You can then use the alias for any
command that uses a URL (for example
hg pull alias1 will be treated as
hg pull URL1).
Two path aliases are special because
they are used as defaults when you do
not provide the URL to a command:
default
default-push
Related
I set up Mercurial in .hgrc to use less as a pager together with customized colors and templates following this guide:
[pager]
pager = LESS='FSrX' less
[templates]
# ...
[color]
mode=terminfo
This works very nicely and I'd like to keep this for all commands except for hg diff. For this command only I'd like to use a completely different mechanism:
No ANSI escape codes in output.
Use https://github.com/dandavison/delta as a pager.
Is it possible to configure Mercurial this way?
I found a solution here which achieves this setup using the extdiff extension.
[extensions]
hgext.extdiff =
[extdiff]
cmd.delta =
[alias]
diff = delta
Earlier I had this workaround - to create a separate alias:
[alias]
d = !$HG diff "$#" | delta
Unfortunately it's not possible to replace the original diff command this way. While it's possible (although discouraged) to replace a command with an alias, in this case it doesn't work: Invoking $HG diff from a diff alias would cause an infinite loop.
Beware of using manuals for Mercurial from 2014 in 2022, they can be outdated and just irrelevant
Correct using less now as pager will be (without artefacts of pager extension)
[pager]
pager = less -FRX
According to hg help pager in fresh HG (6.2), you can, with active pager, disable using it for some command(s)
You can disable the pager for certain commands by adding them to the pager. Ignore list
i.e. have smth. like
[pager]
ignore = diff
and get diff totally without paging
From the other side (contrary to the above point), you can use --config
set/override config option (use 'section.name=value')
option on calling hg diff (when|if you'll have delta as working pager) and for simplicity create hg-alias for "hg diff with delta" like
ddiff = diff --config pager.pager=delta $#
What are the most important special / dot files when using a hg repo ?
Like configuration files and similar.
There are a lot of files that a Mercurial repo will use for configuration or keep track of state, but here are the ones that have the best chance to come in handy:
.hg/last-message.txt -- used by hg commit to store backup of the commit message in case the commit fails.
Example:
My commit message!
.hg/localtags -- define local tags which are not shared among repositories.
Example:
8a7b128ab80b58fc2e63258c9e2bf1f58a5be7c2 myfirsttag
08ff3a0b2e5af9a74becbfdf3e92d6e9a2d0c960 secondtag
6535d105ea795a38808481b160314f9857736c53 thirdtag
.hgignore -- regular expressions that describe file names that should be ignored by hg.
Example:
syntax: glob
*.elc
*.orig
*.rej
*~
*.mergebackup
*.o
*.so
*.dll
*.exe
*.pyd
*.pyc
.hg/hgrc -- defaults and configuration values for mercurial.
Example:
[ui]
verbose = True
username = Joe User <j.user#example.com>
[extensions]
hgext.churn = /home/user/hg/hg/contrib/churn.py
[hgk]
path = /home/user/hg/hg/contrib/hgk
.hgsub -- locations of all subrepositories and where subrepository checkouts came from.
Example:
subrepo1 = https://user#example.org/user/repo
subrepo2 = https://user#example.org/user2/repo2
.hgtags -- contains changeset hash values and text tag names
Example(same format as localtags):
8a7b128ab80b58fc2e63258c9e2bf1f58a5be7c2 myfirsttag
08ff3a0b2e5af9a74becbfdf3e92d6e9a2d0c960 secondtag
6535d105ea795a38808481b160314f9857736c53 thirdtag
I have a large file system in which almost every folder has a file called content.txt
I want to track every file named content.txt and automatically ignore everything else. I want the repo to automatically track new files named content.txt so I don't want to ignore everything in the .hgignore and then manually add.
Anyone know how to do this?
It has to be regexp mode, not glob
You must debug path-part of regexp, but "all except content.txt" draft is re:.*\.(?!content.txt) as hope
Alternative solution can be
* ignore all
* add content.txt files pattern to commit command (-I option), see hg help commit and hg help patterns
hg commit -I '**content.txt'
Edit
re:.*/(?!content.txt)
Try this:
syntax: regexp
\.(?!txt$)[^.]+$ # "*." is followed by "txt" and we're at the end
(?<!\.)txt$ # "txt" follows a "."
(?<!/)content\. # "content." follows path separator
(?<!content)\. # "." follows "content"
I left in the comments I made while experimenting, to make sense of it all. (That's glob syntax in the first one.)
I am on Windows 7 using TortoiseHg 2.1.3 and I have configure it to use the keyword extension (please, no "it is bad practice" remarks, I have studied the arguments and I think in my case it is a valid use).
My mercurial.ini file looks like this:
[ui]
username = xxx
merge =beyondcompare3
ignore = ~/.hgignore
[tortoisehg]
vdiff =beyondcompare3
engmsg = True
ui.language = en
[extensions]
mercurial_keyring =
keyword =
convert =
[keyword]
*.css =
*.js =
*.php =
*.html =
*.htaccess =
[keywordmaps]
Id = {file|basename} {rev}.{node|short} {date|utcdate} {author|user}
Revision = {desc}
Now in any php, html and htaccess file my $Id$ gets expanded as expected when I commit the file, but in any js and css file they do not?
I am at a loss as to understand why, in all files, the document header is the same (I use a template for that which has the $Id$ in it).
Side note:
File-mask pattern for keyword section (and for other parts, where they used) must be **. (not Win-pattern with one star, but two). Sometimes for some filenames it can play
For the ID expansion I'll try probably to create clone of this keyword and test inside problem file-types (don't forget kwshrink|kwexpand magic words), catch differences after tests
To run a command on a single file, I recently realized I can do this:
hg log relglob:UniqueFilename
instead of:
hg log some/really/deep/directory/hierarchy/UniqueFilename
I'd like to take this one step further and make relglob the default matching syntax. Is this possible?
No it's not possible with a configuration option. You could change the match default from relpath to relglob: http://hg.intevation.org/mercurial/crew/file/8bc4ad7e34c8/mercurial/cmdutil.py#l272
But I'm really not sure it is a good idea, for example what if you have several files with the same name?