sapling/tests/test-infinitepushbackup-share.t
Liubov Dmitrieva ae7b506f80 infinitepush backup: separate depends on the remote infinitepush path
Summary:
We are going to support 2 different backends of Commit Cloud: Mercurial and
Mononoke.

Each of them should maintain local backup state separately.

Output of some tests have been slightly changes, this is because a separate backup
state, the same error appears earlier when we are trying the backup stacks.

The idea is to have separate backup states for different remote paths, but
there will be only one cloud sync state for the current source of
truth. We could include there the remote path and then validate that cloud sync
state is correct if the remote path has been changed.

However, for backup states it is much easier to have them separately (and we
will backup in 2 places)

Reviewed By: markbt

Differential Revision: D14138496

fbshipit-source-id: 0a7a763a395be5456cbd724bff7ebc069f03fb0e
2019-02-20 15:36:29 -08:00

59 lines
1.8 KiB
Perl

$ . "$TESTDIR/library.sh"
$ . "$TESTDIR/infinitepush/library.sh"
$ setupcommon
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -m "$1"
> }
$ cat >> $HGRCPATH << EOF
> [extensions]
> share=
> EOF
$ hg init repo
$ cd repo
$ setupserver
$ cd ..
Clone client
$ hg clone ssh://user@dummy/repo client -q
$ hg share --bookmarks client client2
updating working directory
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd client2
$ mkcommit first
$ hg paths
default = ssh://user@dummy/repo
Write smth to backup state file in the shared working copy to check that
it's not read by infinitepush backup client
$ mkdir .hg/infinitepushbackups
$ echo 'rubbish' > .hg/infinitepushbackups/infinitepushbackupstate_f6bce706
$ hg pushbackup
starting backup .* (re)
backing up stack rooted at b75a450e74d5
remote: pushing 1 commit:
remote: b75a450e74d5 first
finished in \d+\.(\d+)? seconds (re)
$ scratchbookmarks
infinitepush/backups/test/*$TESTTMP/client/heads/b75a450e74d5a7708da8c3144fbeb4ac88694044 b75a450e74d5a7708da8c3144fbeb4ac88694044 (glob)
Make sure that backup state is saved only on the "main" repo
$ cat .hg/infinitepushbackups/infinitepushbackupstate_f6bce706
rubbish
$ [ -f ../client/.hg/infinitepushbackups/infinitepushbackupstate_f6bce706 ]
Make sure that isbackedup references the main repo
$ hg isbackedup -r :
b75a450e74d5a7708da8c3144fbeb4ac88694044 backed up
$ hg log -T '{rev}:{node} "{desc}"\n' -r 'notbackedup()'
Make another commit that is not backed up and check that too
$ mkcommit second
$ hg isbackedup -r :
b75a450e74d5a7708da8c3144fbeb4ac88694044 backed up
bc64f6a267a06b03e9e0f96a6deae37ae89a832e not backed up
$ hg log -T '{rev}:{node} "{desc}"\n' -r 'notbackedup()'
1:bc64f6a267a06b03e9e0f96a6deae37ae89a832e "second"