Detect If Push Destination Requires Authorization
Jensen, Aaron
ajensen at webmd.net
Mon Jul 14 18:34:19 UTC 2014
I've got an PowerShell module that wraps Mercurial. It captures stdout, parses it, converts it into objects, then returns those objects to whatever script is using it. When a user uses one of our scripts to push changes to a repository that requires authentication, the 'user:' prompt never shows, because it gets written to stdout, and so users think the script is hanging. Sad trombone. One solution is to make sure the username is specified in the [auth] section of the repository or user's mercurial.ini file.
I spent several hours Friday with .NET's process redirection APIs and could not find a way to detect the `user:` prompt and still show it to the user. Seems that even though .NET supports reading stdout character by character, you can only do so once a full line has been written. Grrr.
So, I'd like my module to be able to detect the situation when a username is needed and show its own prompt for the username, and pass that to the push command as a command line option.
Is there a way to detect if the server I'm pushing to is going to require authorization?*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140714/b44f1d07/attachment-0002.html>
More information about the Mercurial
mailing list