mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
7dc24c7c82
Summary: Backuping changesets is not enougn for restore. We also want to backup heads and bookmarks to completely capture the state of the repo. This diff is the first step in implementing this functionality. It adds new bundle2 part which contains encoded dict (simple json encoding is used). If value in the dict is empty then key is the bookmark pattern to delete. If value is not empty then key is the bookmark name to save and value is a node hash. The reason to put them in the same part is to make it possible to delete and insert into indexapi in one transaction. It's also possible to pass patterns to delete in part parameters but there is a bug in upstream hg that limits parameters' size to 256 and we can potentially have longer bookmarks. Local bookmarks are saved in infinitepush in the following form: infinitepush/backups/USERNAME/HOSTNAME/REPOROOT/bookmarks/LOCAL_BOOKMARK_NAME Local heads are saved in infintiepush in the following form: infinitepush/backups/USERNAME/HOSTNAME/REPOROOTheads/HEAD_HASH Hostname, username and repo root is necessary to distinguish different backups. Test Plan: Run `test-infinitepush-*` Reviewers: durham, rmcelroy, mitrandir, quark Reviewed By: quark Subscribers: quark, mjpieters, #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D4245080 Tasks: 12479677 Signature: t1:4245080:1480518959:aa199d67fac4e2cd2f543651ff56fdd649dac729
72 lines
1.9 KiB
Perl
72 lines
1.9 KiB
Perl
#if no-osx
|
|
$ mkcommit() {
|
|
> echo "$1" > "$1"
|
|
> hg add "$1"
|
|
> hg ci -d "0 0" -m "$1"
|
|
> }
|
|
$ . "$TESTDIR/library-infinitepush.sh"
|
|
$ setupcommon
|
|
|
|
With no configuration it should abort
|
|
$ hg init server
|
|
$ cd server
|
|
$ setupsqlserverhgrc
|
|
$ hg st
|
|
abort: please set infinitepush.sqlhost
|
|
[255]
|
|
$ setupdb
|
|
$ cd ..
|
|
$ hg clone -q ssh://user@dummy/server client1
|
|
$ hg clone -q ssh://user@dummy/server client2
|
|
$ cd client1
|
|
$ setupsqlclienthgrc
|
|
$ cd ../client2
|
|
$ setupsqlclienthgrc
|
|
$ cd ../client1
|
|
$ mkcommit scratchcommit
|
|
|
|
$ hg push -r . --to scratch/book --create
|
|
pushing to ssh://user@dummy/server
|
|
searching for changes
|
|
remote: pushing 1 commit:
|
|
remote: 2d9cfa751213 scratchcommit
|
|
|
|
Make pull and check that scratch commit is not pulled
|
|
$ cd ../client2
|
|
$ hg pull
|
|
pulling from ssh://user@dummy/server
|
|
no changes found
|
|
$ hg up scratch/book
|
|
abort: unknown revision 'scratch/book'!
|
|
[255]
|
|
|
|
Pull scratch commit from the second client
|
|
$ hg pull -B scratch/book
|
|
pulling from ssh://user@dummy/server
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files
|
|
(run 'hg update' to get a working copy)
|
|
$ hg up scratch/book
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(activating bookmark scratch/book)
|
|
$ hg log -G
|
|
@ changeset: 0:2d9cfa751213
|
|
bookmark: scratch/book
|
|
tag: tip
|
|
user: test
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
summary: scratchcommit
|
|
|
|
$ cd ../server
|
|
$ hg book scratch/%erversidebook
|
|
$ hg book serversidebook
|
|
$ cd ../client1
|
|
$ hg book --list-remote 'scratch/*'
|
|
scratch/%erversidebook 0000000000000000000000000000000000000000
|
|
scratch/book 2d9cfa7512136a84a6edb6a7c288145229c2ef7f
|
|
$ hg book --list-remote 'scratch/%*'
|
|
scratch/%erversidebook 0000000000000000000000000000000000000000
|
|
#endif
|