sapling/tests/test-infinitepush-backup-share.t
Stanislau Hlebik d610259241 infinitepush: delete bkpstate from shared working copy
Summary:
infinitepushbackup.tempcleanworkingcopiesbackups option sends special command
to clean backup bookmarks from the server for the shared working copy (i.e.
if we have main repo `fbsource` and shared working copy `fbsource2` we want
to have backups only for `fbsource` not for `fbsource` and `fbsource2`).
Before this diff cleanup commands were send for every backup.
This diff makes them send only if backup state file is present.

Test Plan: arc unit

Reviewers: #mercurial, durham

Reviewed By: durham

Subscribers: durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4929489

Signature: t1:4929489:1493075761:a408300338a10864043b538540d03880a49c4e1a
2017-04-25 01:09:28 -07:00

69 lines
2.3 KiB
Perl

$ . "$TESTDIR/library.sh"
$ . "$TESTDIR/library-infinitepush.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
$ echo 'rubbish' > .hg/infinitepushbackupstate
$ hg pushbackup
starting backup .* (re)
searching for changes
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/infinitepushbackupstate
rubbish
$ [ -f ../client/.hg/infinitepushbackupstate ]
Test hacky infinitepushbackup.tempcleanworkingcopiesbackups config option that
cleans up unnecessary backup bookmarks from the server.
If this option is set and backup state file is present in shared working copy
then there are probably useless backup bookmarks on the server.
In that case `hg pushbackup` will send commands to clean them. And because of it
there should be no 'nothing to backup' line in the output.
$ hg --config infinitepushbackup.tempcleanworkingcopiesbackups=True pushbackup
starting backup .* (re)
finished in \d+\.(\d+)? seconds (re)
Make sure that backup state file is deleted from shared working copy
$ [ -f .hg/infinitepushbackupstate ]
[1]
Now backup state file is deleted, so there should be line `nothing to backup`.
$ hg --config infinitepushbackup.tempcleanworkingcopiesbackups=True pushbackup
starting backup .* (re)
nothing to backup
finished in \d+\.(\d+)? seconds (re)
Make sure nothing important was deleted
$ [ -f ../client/.hg/infinitepushbackupstate ]
$ scratchbookmarks
infinitepush/backups/test/*$TESTTMP/client/heads/b75a450e74d5a7708da8c3144fbeb4ac88694044 b75a450e74d5a7708da8c3144fbeb4ac88694044 (glob)