hg: unknown command 'qimportbz' - mercurial

I followed the instructions on how to setup qimportbz here; I'm on WinXP and instead of adding:
[extensions]
qimportbz = C:\mozilla\mercurial\qimportbz
to a .hgrc file I updated a Mercurial.ini file which seems to be the correct file to add extensions to for me..
then when I run hg help qimportbz I see the help for the qimportbz cmd, but when I try to run hg qimportbz 548590 for example, on the jetpack-sdk hg repo, I get the following error:
hg: unknown command 'qimportbz'

I had this problem. I believe the syntax has changed. Try hg qimport bz://bug_num where bug_num is the bugzilla bug id.

Try instead to declare the extension in your <repo>/.hg/hgrc file, just to check if that has any influence on the issue.

What does your hg debugconfig show? Any mention of qmimportbz? There's a chance you need double backslashes each time you use them, but the output of debugconfig should make that clear if it's the case.
FWIW either .hgrc or Mercurial.ini will work for you. On unix-alikes only .hgrc is checked, but on Windows both are. See the hgrc man page for details on that.

Related

Mercurial - cannot commit merge with missing files error

I have done a 'hg merge' however when I attempt to do a 'hg commit -m "my msg.." I get the following error message :
abort: cannot commit merge with missing files
Can anyone explain how to fix this to allow the commit go through?
Try hg status and look for files in state ! (missing).
The cause is that one of the files which is part of the merge has been deleted. Undelete the file and try again.
Heres my approach
hg status will tell you what files are missing. Then you can either restore the file from somewhere
OR type in hg remove <path/name of missing file>
THEN commit. Your repo will be sane again, darwin willing.
If you are using TortoiseHG, click in View/Commit. It will show you files in state ! (missing).
Right click on the file and choose Revert (undelete the file) and commit.

Problem with loading hggit extension in TortoiseHG

I'm trying to get the hggit extension to work under Windows 7 (64bit) using TortoiseHG (2.1.2). I followed the official setup instructions, i.e. cloning the hg-git repository and adding the "hggit = ..." line to the extensions section in my mercurial.ini file.
However the extension doesn't seem to be loaded. When trying to clone a repository I get the following error :
abort: repository git://... not found!
running
hg help hggit
results in
hg: unknown command 'hggit'
I also don't get any errors at all, no matter what I put in the extensions section of the mercurial.ini file.
Any ideas on what the problem might be ? Are there any log files at all that show me whether there are problems loading the extensions ?
Had the same problem, and in my case I forgot to specify the [extensions] line in the INI file.
Not working:
[ui]
username = My name <my#emailaddress.com>
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
Working:
[ui]
username = My name <my#emailaddress.com>
[extensions]
hgsubversion=D:\Repotools\hg-svn\hgsubversion
hggit=D:\Repotools\hg-git\hggit
When you run the command hg help hggit it will report if the directory path is incorrect.
You should include what you have after hggit =
It should be pointing to the hggit subdirectory in the directory you cloned the repository into.
e.g. hggit=C:\hg-extensions\hg-git\hggit

Specifying per-repository proxy for Mercurial

I have a problem specifying per-repository proxy for Mercurial.
If I specify proxy on command-line, everything works:
hg pull --config http_proxy.host=proxyhost:3128
If I specify proxy in ~/.hgrc, everything works too. Contents of ~/.hgrc:
[http_proxy]
host=proxyhost:3128
But if I put that section into .hg/hgrc of local repository, proxy does not work:
user#NOTE:~/Project$ cat .hg/hgrc
[http_proxy]
host=proxyhost:3128
[paths]
default=http://repohost/Project/
user#NOTE:~/Project$ hg pull --debug
using http://repohost/Project/
sending between command
abort: error: Name or service not known
What's wrong?
Sounds like a bug to me. I can see how it would happen too, though it confuses me a bit that the command line --config option works and the repository-level config doesn't. But not too much.

Mercurial - How to remove a file from version control?

So I accidentally included a config file (different for each machine) into our mercurial repositories.
How can I get Mercurial to not include it in version control? I don't want to delete the file since I still want it. And I don't want to cause the file to get deleted on other developer's working directories either.
And how do I do this in TortoiseHG?
Right click on the file -> TortoiseHG -> Forget Files. Click Forget. Commit and Sync.
Edit:
You'll also want to add the path to your .hgignore to keep it from getting added again. You can right click on the file in the HG Commit dialog and choose to ignore it.
Here's the manual way of doing it through the command line:
Copy the config file somewhere outside of the repository.
Run hg rm path/to/config/file
Add the config file path to your .hgignore.
Commit the repository.
Move the config file back to where you had it.
Do an hg stat on your repository to double check you did everything right. (It shouldn't show up in the list of modified/added files).
Edit:
hg forget is the best way to do this.
Run hg forget path/to/config/file
Edit your .hgignore and add the path to the config file.
hg ci to save your changes.
Run hg stat to ensure everything worked according to plan.
See nates answer for how to do it TortoiseHG.
hg remove or hg remove -f?
I think hg forget also removes it from the branch.
In both cases, files are retained in your directory.
For those using SourceTree, there is an option Stop Tracking when you right click a file, it basically does the same thing as hg forget or git rm --cache, removing the file from repo but not from hard disk.
add it to your ignore list.
See the .hgignore file.
TortoiseHG gives you access to this config file via the "Edit Ignore Filter" menu option.

Adding hooks to TortoiseHg

I am using TortoiseHg and would like to apply a hook to my repo. My repo's .hg/hgrc file is as follows:
[hooks]
pretxncommit = python:hg_checksize.newbinsize
The thing is that I don't know where TortoiseHg's PYTHONPATH variable is set. How do I change it? Or where do I put my Python file so that it is visible by TortoiseHg's Python interpreter?
I cannot find any mention of hooks in TortoiseHg's documentation or through Google?
you can put your .py wherever you like and use a full path to it. the syntax is then
[hooks]
pretxncommit.myhook = python:/path/to/my.py:newbinsize
To enable in-process hooks in TortoiseHg you must put your *.py file into C:\Program Files\TortoiseHg\library.zip. TortoiseHg loads Python files from library.zip.
Reinstalling TortoiseHg will probably mean having to repeat this step.
jk's answer is correct, according to hekevintran's comment he has a typo. It should be
pretxncommit.myhook = python:C:\src\hooks\hg_checksize:newbinsize
it should be a colon between python-file and method, not a period
(confirmed with hg 1.5.1 on Win7)