problem writing custom python client

Gabriel gabriel at opensuse.org
Thu Aug 13 14:52:54 CDT 2009


Hello all,

I'm writing a python client and I wrote a custom ui to manage the
user/password prompts:

class MercurialUi(ui.ui):

    def __init__(self, src=None, get_user_callback=None,
get_pass_callback=None):
        super(MercurialUi, self).__init__(src)
        self.get_user = get_user_callback
        self.get_pass = get_pass_callback

    def prompt(self, msg, choices=None, default="y"):
        if self.get_user:
            return self.get_user()

    def getpass(self, prompt=None, default=None):
        if self.get_pass:
            return self.get_pass()

mui = MercurialUi(get_user_callback=get_user, get_pass_callback=get_pass)
repo = hg.repository(mui, location)
commands.commit(repo.ui, repo, message="test", addremove=True,
logfile=None, date=None)
commands.push(repo.ui, repo, force=False, rev=None)

The authentication failed. It seems push is using it's own ui instance.

Is there a better way to do this? Or maybe someone could point me to a
good API documentation (the one here
http://mercurial.selenic.com/wiki/MercurialApi is not helpful)

-- 
Kind Regards


More information about the Mercurial mailing list