remote-helpers: avoid has_key

It is deprecated.

[fc: do the same in remote-bzr]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: safer bookmark pushing

It is possible that the remote has changed the bookmarks, so let's fetch
them before we make any assumptions, just the way mercurial does.

Probably doesn't make a difference, but better be safe than sorry.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: use python urlparse

It's simpler, and we don't need to depend on certain Mercurial versions.

Also, now we don't update the URL if 'file://' is not present.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: properly mark branches up-to-date

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: add branch_tip() helper

Idea from gitifyhg, the backwards compatibility is how Mercurial used to
do it.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: add support for tag objects

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: custom method to write tags

The one from mercurial is meant for users, on top of the latest tip.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: write tags in the appropriate branch
remote-hg: add custom local tag write code

There's no point in calling the tag method for such simple action. Not
that we care much about the hg-git compat mode, it's mostly just for
comparison testing purposes.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: improve email sanitation

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: add support for schemes extension

So that we can use shortened URLs, for example 'bb:://felipec/repo'
(Bitbucket).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: don't update bookmarks unnecessarily

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: allow refs with spaces

Mercurial supports them, Git doesn't.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: small performance improvement

Load previous manifest first as Mercurial does; for caching reasons.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-hg: use marks instead of inlined files

So that we can find already exported ones. We can never be 100% sure
that we already exported such data, due to mercurial design, it at least
sometimes we should detect them, and so should give ups some performance
boost.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>