mononoke: support bookmark deletion and bookmark move in sync job

Summary:
After this diff new sync job (the one that generates bundles instead of reusing
existing) should be feature complete i.e. it should support the same pushes
as normal sync job.

One noteable refactoring is adding BookmarkChange enum. Previously we were passing and converting `from_` and `to_` parameters down the stack and also doing conversion in the middle, and it was easy to mix them up and use `from_hg_cs_id` instead of `to_hg_cs_id` and vice versa. My hope is that with this enum isolates most of the `from_` and `to_` shenanigans in one places so that's it's easier to keep track of it.

Reviewed By: krallin

Differential Revision: D17546808

fbshipit-source-id: 1b5e2553f80b33996ec361e89b01cb55ec811ec7
This commit is contained in:
Stanislau Hlebik 2019-09-25 10:26:54 -07:00 committed by Facebook Github Bot
parent f8ce273485
commit c85a0eeb09

View File

@ -47,6 +47,28 @@ Push to Mononoke
$ mkcommit pushcommit
$ hgmn push -r . --to newbook --create -q
$ BOOK_LOC=$(hg log -r newbook -T '{node}')
Force push
$ hg up -q 0
$ mkcommit forcepush
$ hgmn push -r . --to newbook --create -q
Bookmark move
$ hgmn push -r "$BOOK_LOC" --to newbook --pushvar NON_FAST_FORWARD=true
pushing rev 1e43292ffbb3 to destination ssh://user@dummy/repo bookmark newbook
searching for changes
no changes found
updating bookmark newbook
[1]
Delete a bookmark
$ hgmn push --delete newbook
pushing to ssh://user@dummy/repo
searching for changes
no changes found
deleting remote bookmark newbook
[1]
Sync it to another client
$ cd $TESTTMP
@ -56,25 +78,29 @@ Sync it to another client
> EOF
Sync a creation of a bookmark
$ mononoke_hg_sync repo-hg 1 --generate-bundles
* using repo "repo" repoid RepositoryId(0) (glob)
running * 'hg -R repo-hg serve --stdio' (glob)
sending hello command
sending between command
remote: * (glob)
remote: capabilities* (glob)
remote: 1
sending clienttelemetry command
connected to * (glob)
creating a peer took: * (glob)
* preparing log entry #2 ... (glob)
* successful prepare of entry #2 (glob)
* syncing log entries [2] ... (glob)
single wireproto command took: * (glob)
using * as a reports file (glob)
sending unbundlereplay command
remote: pushing 1 changeset:
remote: 1e43292ffbb3 pushcommit
unbundle replay batch item #0 successfully sent
* queue size after processing: * (glob)
$ mononoke_hg_sync repo-hg 1 --generate-bundles 2>&1 | grep 'successful sync of entries'
* successful sync of entries [2] (glob)
$ cd $TESTTMP/repo-hg
$ hg log -r newbook -T '{desc}'
pushcommit (no-eol)
$ cd -
$TESTTMP
Sync force push
$ mononoke_hg_sync repo-hg 2 --generate-bundles 2>&1 | grep 'successful sync of entries'
* successful sync of entries [3] (glob)
Sync bookmark move
$ mononoke_hg_sync repo-hg 3 --generate-bundles 2>&1 | grep 'successful sync of entries'
* successful sync of entries [4] (glob)
Sync deletion of a bookmark
$ mononoke_hg_sync repo-hg 4 --generate-bundles 2>&1 | grep 'successful sync of entries'
* successful sync of entries [5] (glob)
$ cd $TESTTMP/repo-hg
$ hg log -r newbook
abort: unknown revision 'newbook'!
(if newbook is a remote bookmark or commit, try to 'hg pull' it first)
[255]