Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable a mercurial extension in .hgrc only if it's present

Tags:

mercurial

hgrc

I have a lot of things in my .hgrc file so I keep it in a repository and share it between computers.

I have a lot of extensions enabled in the [extensions] section, but I don't necessarily want to use all of them on all of my computers.

Unfortunately, whenever I try to use Mercurial with my shared .hgrc file on a computer where I don't have every single one of the specified extensions installed, I get a message of the form:

*** failed to import extension evolve from $HG_EXTENSIONS/mutable-history/hgext/evolve.py: [Errno 2] No such file or directory: '/home/botond/programs/mercurial/extensions/mutable-history/hgext/evolve.py'

every time I run any hg command!

Is there a way to avoid this? For example, is there a way to specify in the .hgrc file, "load this extension if you can find it, otherwise don't load it and just be quiet about it"? (Then, if I actually try to use the extension, I'd get an error.)


additional search terms:

  • How to conditionally enable Mercurial extensions
  • Activate Mercurial extension based on condition
  • Enable a Mercurial extension only if it exists
like image 765
HighCommander4 Avatar asked Nov 11 '22 07:11

HighCommander4


1 Answers

  • Use Projrc extension
  • Enable all and any extensions in projrc's config
  • Disable missing|not needed files in .hg/hgrc
like image 175
Lazy Badger Avatar answered Nov 15 '22 12:11

Lazy Badger