Mercurial > hg
view tests/test-bookmarks-strip.t @ 37295:45b39c69fae0
wireproto: separate commands tables for version 1 and 2 commands
We can't easily reuse existing command handlers for version 2
commands because the response types will be different. e.g. many
commands return nodes encoded as hex. Our new wire protocol is
binary safe, so we'll wish to encode nodes as binary.
We /could/ teach each command handler to look at the protocol
handler and change behavior based on the version in use. However,
this would make logic a bit unwieldy over time and would make
it harder to design a unified protocol handler interface. I think
it's better to create a clean break between version 1 and version 2
of commands on the server.
What I imagine happening is we will have separate @wireprotocommand
functions for each protocol generation. Those functions will parse the
request, dispatch to a common function to process it, then generate
the response in its own, transport-specific manner.
This commit establishes a separate table for tracking version 1
commands from version 2 commands. The HTTP server pieces have been
updated to use this new table.
Most commands are marked as both version 1 and version 2, so there is
little practical impact to this change.
A side-effect of this change is we now rely on transport registration
in wireprototypes.TRANSPORTS and certain properties of the protocol
interface. So a test had to be updated to conform.
Differential Revision: https://phab.mercurial-scm.org/D2982
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 28 Mar 2018 10:40:41 -0700 |
parents | e78a80f8f51e |
children |
line wrap: on
line source
$ echo "[extensions]" >> $HGRCPATH $ echo "mq=" >> $HGRCPATH $ hg init $ echo qqq>qqq.txt rollback dry run without rollback information $ hg rollback no rollback information available [1] add file $ hg add adding qqq.txt commit first revision $ hg ci -m 1 set bookmark $ hg book test $ echo www>>qqq.txt commit second revision $ hg ci -m 2 set bookmark $ hg book test2 update to -2 (deactivates the active bookmark) $ hg update -r -2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (leaving bookmark test2) $ echo eee>>qqq.txt commit new head $ hg ci -m 3 created new head bookmarks updated? $ hg book test 1:25e1ee7a0081 test2 1:25e1ee7a0081 strip to revision 1 $ hg strip 1 saved backup bundle to $TESTTMP/.hg/strip-backup/*-backup.hg (glob) list bookmarks $ hg book test 0:5c9ad3787638 test2 0:5c9ad3787638