Question

I have a local copy of mercurial repository "proj1". I want get incoming changes using The Mercurial API via python script. I tried make it like that:

from mercurial import hg, ui, commands, util, scmutil, httpconnection

repopath = "/home/username/develop/hg_repo"

myui = ui.ui()

repo = hg.repository(myui, repopath)

commands.incoming(myui, repo)

This code failed with message:

mercurial.error.RepoError: storage default not found

But commands.summary(...), commands.branch(...), commands.branches(...) is working OK.

Can you help me? Thanks.

PS: Sorry for my english

Was it helpful?

Solution

First, You must pass to commands ui from repo object: repo.ui:

commands.incoming(repo.ui, repo)

(http://mercurial.808500.n3.nabble.com/repository-default-not-found-using-API-td3999339.html) And than we have KeyError: 'bundle'

I dont know why mercurial does not set the default for options bundle and force, so we need pass its too:

commands.incoming(repo.ui, repo, bundle=None,force=False)

Also, You can set hardly your remote repo:

commands.incoming(repo.ui, repo, source='default', bundle=None,force=False)

For more see lib/site-packages/mercurial/commands.py, hg.py

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top