sapling/tests/test-commitcloud-sync-workspacenames.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

135 lines
5.4 KiB
Perl

$ cat >> $HGRCPATH << EOF
> [extensions]
> amend =
> commitcloud =
> infinitepush =
> rebase =
> remotenames =
> share =
> [ui]
> ssh = python "$TESTDIR/dummyssh"
> [infinitepush]
> branchpattern = re:scratch/.*
> [commitcloud]
> hostname = testhost
> [experimental]
> evolution = createmarkers, allowunstable
> EOF
$ setconfig remotefilelog.reponame=server
$ hg init server
$ cd server
$ cat >> .hg/hgrc << EOF
> [infinitepush]
> server = yes
> indextype = disk
> storetype = disk
> reponame = testrepo
> EOF
Make shared part of config
$ cat >> shared.rc << EOF
> [commitcloud]
> servicetype = local
> servicelocation = $TESTTMP
> user_token_path = $TESTTMP
> auth_help = visit https://localhost/oauth to generate a registration token
> education_page = https://someurl.com/wiki/CommitCloud
> owner_team = The Test Team @ FB
> EOF
Make a clone of the server
$ hg clone ssh://user@dummy/server client1 -q
$ cd client1
$ cat ../shared.rc >> .hg/hgrc
$ hg cloud auth -t xxxxxx
setting authentication token
authentication successful
Check generation of default workspace name based on user name and email
$ hg cloud join
commitcloud: this repository is now connected to the 'user/test/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/test/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
$ HGUSER="Test Longname <test.longname@example.com>" hg cloud join
commitcloud: this repository is now connected to the 'user/test.longname@example.com/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/test.longname@example.com/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
$ HGUSER="Test Longname <test.longname@example.com>" hg cloud join --config commitcloud.email_domain=example.com
commitcloud: this repository is now connected to the 'user/test.longname/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/test.longname/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
$ HGUSER="Another Domain <other.longname@example.org>" hg cloud join --config commitcloud.email_domain=example.com
commitcloud: this repository is now connected to the 'user/other.longname@example.org/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other.longname@example.org/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
Can join workspaces using raw workspace names
$ hg cloud join --raw-workspace project/unsupported
commitcloud: this repository is now connected to the 'project/unsupported' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'project/unsupported'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
Test deprecated joining a user workspace via full workspace name
$ hg cloud join -w user/other/work
specifying full workspace names with '-w' is deprecated
(use '-u' to select another user's workspaces)
commitcloud: this repository is now connected to the 'user/other/work' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other/work'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
But specifying a user and a workspace name like this just treats the workspace name as-is.
$ hg cloud join -u other -w user/nested/name
commitcloud: this repository is now connected to the 'user/other/user/nested/name' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other/user/nested/name'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
Test joining other users' workspaces the right way
$ hg cloud join -u other -w work
commitcloud: this repository is now connected to the 'user/other/work' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other/work'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
Test joining other users' default workspace
$ hg cloud join -u other
commitcloud: this repository is now connected to the 'user/other/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud
Test joining other user's workspace by matching domain email
$ hg cloud join -u other@example.com --config commitcloud.email_domain=example.com
commitcloud: this repository is now connected to the 'user/other/default' workspace for the 'server' repo
commitcloud: synchronizing 'server' with 'user/other/default'
commitcloud: commits synchronized
finished in * (glob)
$ hg cloud leave
commitcloud: this repository is now disconnected from commit cloud