sapling/tests/test-commitcloud-backup-lfs.t
Mark Thomas 81d738646f commitcloud: incorporate infinitepush backups into commitcloud
Summary:
Merge the functionality of the infinitepushbackup extension (backing up commits
to commit cloud) into the commitcloud extension.

These two extensions are highly coupled, and the commitcloud extension
monkey-patches the infinitepushbackup extension for a lot of its functionality.
There is also a lot of code duplication between the two extensions which we can
remove if they are part of the same extension.

The infinitepushbackup commands (`hg pushbackup`, ...) are moved to subcommands
of the `hg cloud` command, e.g. `hg cloud backup`.

Each feature of the infinitepushbackup extension is moved to a new module
in the commit cloud extension:

The `background` module controls background execution of `hg cloud backup` and
`hg cloud sync`.

The `backupbookmarks` module tracks and updates scratch bookmarks for backups.
This will be deprecated in the future.

The `backupstate` module tracks whether or not a commit has been backed up.
This is now tracked separately from backup bookmarks in a new file:
`.hg/commitcloud/backedupheads.<remote-identifier>`.  This also covers hidden
commits, preventing a re-backup of previously backed up commits when they are
unhidden.

Previously the commitcloud extension customized the smartlog annotations: `Backing up`
became `Syncing`, etc.  This is now removed for consistency.

Previously the infinitepushbackup extension disabled background backup by
injecting an `infinitepushbackup.disableduntil` config entry into the user's
config.  This is now replaced with a state file at `.hg/commitcloud/autobackup`.
Either option can be set to disable auto backup.  Commit cloud will wait until
both have expired before starting to run background backups again.

Reviewed By: DurhamG

Differential Revision: D15276939

fbshipit-source-id: 1d28989a157286e47d3dd97ca9c70b27f692dda1
2019-05-20 06:19:47 -07:00

90 lines
2.4 KiB
Perl

$ enable amend
Setup common infinitepush
$ . "$TESTDIR/library.sh"
$ . "$TESTDIR/infinitepush/library.sh"
$ setupcommon
Setup lfs
$ enable lfs
$ setconfig experimental.changegroup3=true
$ setconfig lfs.threshold=10B lfs.url="file:$TESTTMP/dummy-remote/"
Setup server repo
$ hg init repo
$ cd repo
$ setupserver
$ echo 1 > 1
$ hg add 1
$ hg ci -m initial
Setup client
$ cd ..
$ hg clone ssh://user@dummy/repo client -q
$ cd client
$ echo aaaaaaaaaaa > largefile
$ hg ci -Aqm commit
$ hg debugdata largefile 0
version https://git-lfs.github.com/spec/v1
oid sha256:ab483e1d855ad0ea27a68eeea02a04c1de6ccd2dc2c05e3a48c9a1ebb8af5f99
size 12
x-is-binary 0
$ hg push -r . --to scratch/lfscommit --create
pushing to ssh://user@dummy/repo
searching for changes
remote: pushing 1 commit:
remote: 0da81a72db1a commit
$ scratchbookmarks
scratch/lfscommit 0da81a72db1a2d8256845e3808971f33e73d24c4
$ cd ..
Setup another client
$ hg clone ssh://user@dummy/repo client2 -q
$ cd client2
$ hg update scratch/lfscommit
'scratch/lfscommit' does not exist locally - looking for it remotely...
pulling from ssh://user@dummy/repo
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
new changesets 0da81a72db1a
(run 'hg update' to get a working copy)
'scratch/lfscommit' found remotely
pull finished in * sec (glob)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark scratch/lfscommit)
Make pushbackup that contains bundle with 2 heads
$ cd ../client
$ hg up -q tip
$ mkcommit newcommit
$ hg prev -q
[0da81a] commit
$ mkcommit newcommit2
$ hg cloud backup
backing up stack rooted at 0da81a72db1a
remote: pushing 3 commits:
remote: 0da81a72db1a commit
remote: 5f9d85f9e1c6 newcommit
remote: c800524c1b76 newcommit2
commitcloud: backed up 2 commits
$ hg cloud check -r .
c800524c1b7637c6f3f997d1459237d01fe1ea10 backed up
Pull just one head to trigger rebundle
$ cd ../client2
$ hg pull -r c800524c1b7637c6f3f997d1459237d01fe1ea10
pulling from ssh://user@dummy/repo
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 2 files
new changesets c800524c1b76
(run 'hg update' to get a working copy)