Mercurial TextAuth plugin error “Parse exception: '*** failed to import extension textauth.file from C:\inetpub\auth: invalid syntax (auth, line 1)'”

StackOverflow https://stackoverflow.com//questions/12654225

Frage

I've installed the TextAuth plugin to Mercurial to add basic authentication for pulling/pushing code.

Via Tortoise HG Mercurial interface, I get the error below, but the operation continues and authentication is accepted and working correctly, i.e, if I change the username inside the file named "auth", the old one is no longer accepted, etc.

This wasn't a problem until I started using Zend Studio with the Mercurial Eclipse plugin, the same error is thrown from Mercurial, but Zend/Eclipse doesn't continue, like the Tortoise HG workbench does, so it's stopping work completely...

Any help would be great, thanks.

"Parse exception: '*** failed to import extension textauth.file from C:\inetpub\auth: invalid syntax (auth, line 1)'"

EDIT: Here is the contents of the plain text file. It's UTF-8 without BOM.

david:sha512:34306d47f380e8c4:3e1abe5b38db2b56b997adca78030a1a085dcf2961413820813b9972b3d91c676921419b5b2e3953571e35a4efd8f68e95e9880b2b54756ab5c7256fb6c6cdaf
steven:sha512:589c75e34563ec0c:ba097345634e7ae5d1b577b2093563c1ed06af78e90e8197116140c22dd14745d6aaebaf05bb005a4e916114fec086b95b2d6eab1286be94c2d91f7a5d4426c
dev1:sha512:dcdb2734655344b:78531b07d09345634ab2265fc5acc3b2a92386f2ab2168ce559f6db5bf9da034fde50cbec128ebb89a210fcf918582ed366de1f0998e6c570a1ce498429a4ad
dev2:sha512:c8fc3a3456d9470:6efca993620138644d203695ced07f6aaddb0d2752fd12970639012f66a5c07b210564b9046d818bfcbc978aff5151400269b9a816ed9279a929cb46aa4a53
dev3:sha512:d26466ec818cd62a:ebc0ff463546e3456aff6e8828bbc8ff812990ddaa4f112d3d932d943598e7b27c6547c14b3786b2ef3fe955eb01e12c67aaea175bc011ae0b6eb1fa4f093ece

The passwords have had characters scrambled, so if you try it and it doesn't work, that's why, but they were generated by the authedit command, and are accepted during authentication.

Here is the contents of the hgrc file with obvious stuff obfuscated/changed.

# Generated by TortoiseHg


[web]
push_ssl = False
allow_push = *
[ui]
username = david
[paths]
repo = http://domain.com/
Live = C:\inetpub\domain.com

[auth]
repo.schemes = http
[auth]
repo.username = david
repo.password = passstring

[extensions]
textauth = C:\inetpub\textauth.py
textauth.file = C:\inetpub\auth

[textauth]
file = C:\inetpub\auth

[tortoisehg]
postpull = update
autoresolve = True
War es hilfreich?

Lösung

I can't find reference to the textauth plugin online, but I suspect this is your problem:

[extensions]
textauth = C:\inetpub\textauth.py
textauth.file = C:\inetpub\auth

That's saying "load two separate extensions one called textauth and one (illegally) called textauth.file.

You want this:

[extensions]
textauth = C:\inetpub\textauth.py

[textauth]
file = C:\inetpub\auth

So just remove the textauth.file = line in the [extensions] section.

It's an easy mistake to make because when given on the command line the [section] and key syntax does become section.key like this:

hg --config ui.username=david ...

but in a .hgrc that's:

[ui]
username = david

Andere Tipps

Everything under [extensions] is treated as a plugin. The C:\inetpub\auth file is not a plugin, it's a file used by a plugin. You should just have (in addition to the textauth.py extension of course):

[textauth]
file = C:\inetpub\auth

This part of the documentation is where that is explained, it would have been nice if they had given an example:

textauth

Section that controls the behavior of the textauth extension.

Supported arguments:

file The path to the file containing authentication information. The contents of this file should be as described below.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top