[RFC] Pushkey Concept

Greg Ward greg-hg at gerg.ca
Mon Sep 21 12:29:49 CDT 2009


On Mon, Sep 21, 2009 at 7:59 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
>>  - puskey(string namespace, string key, string value, boolean force=False)
>>  - listkeys(string namespace)
>
> I hope you meant 'pushkey' instead of 'puskey' there? I'd prefer
> pushkey to accept a dictionary like {'bookmarks': {'mybookmark':
> '34abc3254'}}, so we can reduce the number of roundtrips if we want to
> push many keys in one go.

OTOH, it's nice to be able to push arbitrarily large mappings without
using arbitrary amounts of memory.  That argues for pushing dicts in
chunks of N keys at a time.  Make N large enough that we don't suffer
too many round-trips, but small enough that we don't use up huge
amounts of memory.  My gut says 1000...5000.  If that's too complex,
though, all-in-one is much better than pushing one key at a time.

Incidentally, I have a great use case for this protocol extension that
has nothing to do with bookmarks or tags: bugmap.  That is, I have
written an extension for work that associates bug IDs with changeset
IDs.  You use it like

  hg commit --bug 432 --bug 325 -m"fix two bugs"

which adds a line to .hg/bugmap.  Around the time of pushing that
changeset, you also need to run

  hg pushbugs

which connects to a configured MySQL server and turns the line in
.hg/bugmap into two rows of a bugmap table.  (It then writes a new
empty .hg/bugmap.)  My extension wraps 'push' to make this automatic,
but the manual command is there just in case.

It would be great if this information could be sent over the same
channel as a regular 'hg push', and let server-side code worry about
turning it into database rows.

Greg



More information about the Mercurial-devel mailing list