sapling/tests/test-commitcloud-backup-logging.t

71 lines
3.3 KiB
Perl
Raw Normal View History

$ . "$TESTDIR/library.sh"
$ . "$TESTDIR/infinitepush/library.sh"
$ setupcommon
$ hg init repo
$ cd repo
$ setupserver
$ cd ..
$ hg clone ssh://user@dummy/repo client -q
$ cat >> $TESTTMP/uilog.py <<EOF
> from edenscm.mercurial import extensions
> from edenscm.mercurial import ui as uimod
> def uisetup(ui):
> extensions.wrapfunction(uimod.ui, 'log', mylog)
> def mylog(orig, self, service, *msg, **opts):
> if service in ['infinitepush']:
> kwstr = ", ".join("%s=%s" % (k, v) for k, v in
> sorted(opts.iteritems()))
> msgstr = msg[0] % msg[1:]
> self.warn('%s: %s (%s)\n' % (service, msgstr, kwstr))
> return orig(self, service, *msg, **opts)
> EOF
$ cat >> repo/.hg/hgrc <<EOF
> [extensions]
> uilog=$TESTTMP/uilog.py
> EOF
$ cd client
$ mkcommit commit
$ hg push -r . --to scratch/scratchpush --create
pushing to ssh://user@dummy/repo
searching for changes
remote: infinitepush: b2x:infinitepush \(eventtype=start, hostname=.+, requestid=\d+, user=\w+\) (re)
remote: pushing 1 commit:
remote: 7e6a6fd9c7c8 commit
remote: infinitepush: bundlestore \(bundlesize=546, eventtype=start, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: bundlestore \(bundlesize=546, elapsedms=.+, eventtype=success, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: index \(eventtype=start, hostname=.+, newheadscount=1, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: index \(elapsedms=.+, eventtype=success, hostname=.+, newheadscount=1, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: b2x:infinitepush \(elapsedms=.+, eventtype=success, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
$ cd ..
Check that logging works for b2x:infinitepushscratchbookmarks part
$ cd client
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 16:11:59 +03:00
$ hg cloud backup
remote: infinitepush: b2x:infinitepushscratchbookmarks \(eventtype=start, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: b2x:infinitepushscratchbookmarks \(elapsedms=.+, eventtype=success, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
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 16:11:59 +03:00
nothing to back up
$ cd ..
Make upload to bundlestore fail
$ cat >> repo/.hg/hgrc <<EOF
> [scratchbranch]
> storepath=/dev/null
> EOF
$ cd client
$ mkcommit failpushcommit
$ hg push -r . --to scratch/scratchpush 2>err
pushing to ssh://user@dummy/repo
searching for changes
[255]
$ grep '^remote: ' err
remote: infinitepush: b2x:infinitepush \(eventtype=start, hostname=.+, requestid=\d+, user=\w+\) (re)
remote: pushing 2 commits:
remote: 7e6a6fd9c7c8 commit
remote: bba29d9d577a failpushcommit
remote: infinitepush: bundlestore \(bundlesize=1067, eventtype=start, hostname=.+, requestid=\d+, user=\w+\) (re)
remote: infinitepush: bundlestore \(bundlesize=1067, elapsedms=[-+0-9.e]+, errormsg=\[Errno 20\] \$ENOTDIR\$: '/dev/null/\d+', eventtype=failure, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: infinitepush: b2x:infinitepush \(elapsedms=[-+0-9.e]+, errormsg=\[Errno 20\] \$ENOTDIR\$: '/dev/null/\d+', eventtype=failure, hostname=.+, reponame=babar, requestid=\d+, user=\w+\) (re)
remote: abort: \$ENOTDIR\$: '/dev/null/\d+' (re)