Precedence of --config options

Jason Harris jason at jasonfharris.com
Sun Nov 13 10:17:30 CST 2011


Hi,

I was wondering if the following is a bug or intended behavior: (This came up from an issue in MacHg.)

If I have some extension set in my ~/.hgrc, eg:

-----------
[extensions]
hgext.histedit = /Users/jason/Library/MercurialExtensions/histedit/hg_histedit.py
-----------

But I have also copied the extension into the main Mercurial layout by adding the extension here (and changing the name):

   /Library/Python/2.7/site-packages/hgext/histedit/__init__.py

(This is the place in OSX where mercurial resides (with the default install...))

Then if I call from the command line:

   hg histedit --config ext.histedit=/Library/Python/2.7/site-packages/hgext/histedit/__init__.py --rev 3576

then which histedit extension should be used? I would have though the path passed in via --config would have taken precedence over the value specified in hgrc but it appears not from my testing...

(To do this I added a line   ui.status("local\n") to the beginning of the histedit command for the version at /Library/Python/2.7/site-packages/hgext/histedit/__init__.py and I added the line         ui.status("~/Library/MercurialExtensions\n") for the version at  /Users/jason/Library/MercurialExtensions/histedit/hg_histedit.py.)

Now with the ~/.hgrc set as hgext.histedit= I get the following output:
[salt:/Development/MacHgDev/MacHgClone16] MacHgClone16 805(805) $ hg histedit --rev 800
local
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

But if I set the extension in the ~/.hgrc to the explicit path given above then I get the following:
[salt:/Development/MacHgDev/MacHgClone16] MacHgClone16 805(805) $ hg histedit --config ext.histedit=/Library/Python/2.7/site-packages/hgext/histedit/__init__.py --rev 800
~/Library/MercurialExtensions
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[salt:/Development/MacHgDev/MacHgClone16] MacHgClone16 805(805) $ 


I had even hoped that I could specify:

   hg histedit --config ext.histedit= --rev 3576

Which would tell Mercurial to use the local histedit extension and not anything specified in any of the hgrc's on the HGRCPATH.

Thus, is this a bug or intended behavior? If it's a bug I can file it / and or look into fixing it...

Thanks!
   Jas


More information about the Mercurial-devel mailing list