Mork0075
Mork0075

Reputation: 5955

How to retrieve available branches from a Bitbucket repository?

It is possible to retrieve the local branches from a local repository with hg branches. Is it possible to do this also with a remote repository programatically?

Upvotes: 2

Views: 1915

Answers (2)

Benjamin Pollack
Benjamin Pollack

Reputation: 28460

Unfortunately, there is no way to determine the branches in a remote Mercurial repository without pulling in the repository. You can avoid saving data on disk, by getting the information you desire by using hg incoming, but that command works by pulling the entire repository data anyway--likely not what you want. Unfortunately, your best bet is probably going to be simply to perform a check-out, and then query your now-local repository.

If that's truly unacceptable, you have two additional solutions: you can screen-scape the Bitbucket page for your repository, using a tool like BeautifulSoup or lxml, or you can wait until Bitbucket releases their API, which will likely provide this functionality.

Upvotes: 5

Related Questions