Using the API

Chris Stromberger chris.stromberger at gmail.com
Tue Nov 4 09:18:06 CST 2008


I'm trying to get a simple bit of Python working using the hg api.  Found a
few examples online, but have a few questions.  In the wiki, it seems to
recommend digging into the code and using the cmdutil module directly,
instead of the commands module.  So, after some digging, here is what I
have.

I want to replace these commands with an api equivalent:

hg -q --config ui.username="user" ci -A -m "msg"
hg bundle -q -a 'bundlefilename'

So I have this so far:

from mercurial import ui, hg, cmdutil, commands
hgui = ui.ui(quiet = True)
repo = hg.localrepo.localrepository(hgui, pathToRepo)
cmdutil.addremove(repo)
repo.commit(text = "msg", user = "user")
commands.bundle(hgui, repo, 'bundlefilename', all=True)

Just wondering if this the right/best way to do this?  I did not see any
undbundle in cmdutils, so went with the commands function, in spite of the
wiki recommendation.

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial/attachments/20081104/c71330ae/attachment.htm 


More information about the Mercurial mailing list