The test doesn't pass for what superficially look like good
reasons. We'll need to come back to it later.
- skip-blame because it's b prefixes and a couple of b'N' instead of str(N)
indygreg |
hg-reviewers |
The test doesn't pass for what superficially look like good
reasons. We'll need to come back to it later.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-bundle2-exchange.t (52 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
> from mercurial import exchange | > from mercurial import exchange | ||||
> from mercurial import extensions | > from mercurial import extensions | ||||
> from mercurial import registrar | > from mercurial import registrar | ||||
> cmdtable = {} | > cmdtable = {} | ||||
> command = registrar.command(cmdtable) | > command = registrar.command(cmdtable) | ||||
> | > | ||||
> configtable = {} | > configtable = {} | ||||
> configitem = registrar.configitem(configtable) | > configitem = registrar.configitem(configtable) | ||||
> configitem('failpush', 'reason', | > configitem(b'failpush', b'reason', | ||||
> default=None, | > default=None, | ||||
> ) | > ) | ||||
> | > | ||||
> def _pushbundle2failpart(pushop, bundler): | > def _pushbundle2failpart(pushop, bundler): | ||||
> reason = pushop.ui.config('failpush', 'reason') | > reason = pushop.ui.config(b'failpush', b'reason') | ||||
> part = None | > part = None | ||||
> if reason == 'abort': | > if reason == b'abort': | ||||
> bundler.newpart('test:abort') | > bundler.newpart(b'test:abort') | ||||
> if reason == 'unknown': | > if reason == b'unknown': | ||||
> bundler.newpart('test:unknown') | > bundler.newpart(b'test:unknown') | ||||
> if reason == 'race': | > if reason == b'race': | ||||
> # 20 Bytes of crap | > # 20 Bytes of crap | ||||
> bundler.newpart('check:heads', data='01234567890123456789') | > bundler.newpart(b'check:heads', data=b'01234567890123456789') | ||||
> | > | ||||
> @bundle2.parthandler("test:abort") | > @bundle2.parthandler(b"test:abort") | ||||
> def handleabort(op, part): | > def handleabort(op, part): | ||||
> raise error.Abort('Abandon ship!', hint="don't panic") | > raise error.Abort(b'Abandon ship!', hint=b"don't panic") | ||||
> | > | ||||
> def uisetup(ui): | > def uisetup(ui): | ||||
> exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart | > exchange.b2partsgenmapping[b'failpart'] = _pushbundle2failpart | ||||
> exchange.b2partsgenorder.insert(0, 'failpart') | > exchange.b2partsgenorder.insert(0, b'failpart') | ||||
> | > | ||||
> EOF | > EOF | ||||
$ cd main | $ cd main | ||||
$ hg up tip | $ hg up tip | ||||
3 files updated, 0 files merged, 1 files removed, 0 files unresolved | 3 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
$ echo 'I' > I | $ echo 'I' > I | ||||
$ hg add I | $ hg add I | ||||
Check abort from mandatory pushkey | Check abort from mandatory pushkey | ||||
$ cat > mandatorypart.py << EOF | $ cat > mandatorypart.py << EOF | ||||
> from mercurial import exchange | > from mercurial import exchange | ||||
> from mercurial import pushkey | > from mercurial import pushkey | ||||
> from mercurial import node | > from mercurial import node | ||||
> from mercurial import error | > from mercurial import error | ||||
> @exchange.b2partsgenerator('failingpuskey') | > @exchange.b2partsgenerator(b'failingpuskey') | ||||
> def addfailingpushey(pushop, bundler): | > def addfailingpushey(pushop, bundler): | ||||
> enc = pushkey.encode | > enc = pushkey.encode | ||||
> part = bundler.newpart('pushkey') | > part = bundler.newpart(b'pushkey') | ||||
> part.addparam('namespace', enc('phases')) | > part.addparam(b'namespace', enc(b'phases')) | ||||
> part.addparam('key', enc('cd010b8cd998f3981a5a8115f94f8da4ab506089')) | > part.addparam(b'key', enc(b'cd010b8cd998f3981a5a8115f94f8da4ab506089')) | ||||
> part.addparam('old', enc(str(0))) # successful update | > part.addparam(b'old', enc(b'0')) # successful update | ||||
> part.addparam('new', enc(str(0))) | > part.addparam(b'new', enc(b'0')) | ||||
> def fail(pushop, exc): | > def fail(pushop, exc): | ||||
> raise error.Abort('Correct phase push failed (because hooks)') | > raise error.Abort(b'Correct phase push failed (because hooks)') | ||||
> pushop.pkfailcb[part.id] = fail | > pushop.pkfailcb[part.id] = fail | ||||
> EOF | > EOF | ||||
$ cat >> $HGRCPATH << EOF | $ cat >> $HGRCPATH << EOF | ||||
> [hooks] | > [hooks] | ||||
> pretxnchangegroup= | > pretxnchangegroup= | ||||
> pretxnclose.failpush= | > pretxnclose.failpush= | ||||
> prepushkey.failpush = sh -c "echo 'do not push the key !'; false" | > prepushkey.failpush = sh -c "echo 'do not push the key !'; false" | ||||
> [extensions] | > [extensions] | ||||
(Failure from a the pushkey) | (Failure from a the pushkey) | ||||
$ cat > mandatorypart.py << EOF | $ cat > mandatorypart.py << EOF | ||||
> from mercurial import exchange | > from mercurial import exchange | ||||
> from mercurial import pushkey | > from mercurial import pushkey | ||||
> from mercurial import node | > from mercurial import node | ||||
> from mercurial import error | > from mercurial import error | ||||
> @exchange.b2partsgenerator('failingpuskey') | > @exchange.b2partsgenerator(b'failingpuskey') | ||||
> def addfailingpushey(pushop, bundler): | > def addfailingpushey(pushop, bundler): | ||||
> enc = pushkey.encode | > enc = pushkey.encode | ||||
> part = bundler.newpart('pushkey') | > part = bundler.newpart(b'pushkey') | ||||
> part.addparam('namespace', enc('phases')) | > part.addparam(b'namespace', enc(b'phases')) | ||||
> part.addparam('key', enc('cd010b8cd998f3981a5a8115f94f8da4ab506089')) | > part.addparam(b'key', enc(b'cd010b8cd998f3981a5a8115f94f8da4ab506089')) | ||||
> part.addparam('old', enc(str(4))) # will fail | > part.addparam(b'old', enc(b'4')) # will fail | ||||
> part.addparam('new', enc(str(3))) | > part.addparam(b'new', enc(b'3')) | ||||
> def fail(pushop, exc): | > def fail(pushop, exc): | ||||
> raise error.Abort('Clown phase push failed') | > raise error.Abort(b'Clown phase push failed') | ||||
> pushop.pkfailcb[part.id] = fail | > pushop.pkfailcb[part.id] = fail | ||||
> EOF | > EOF | ||||
$ cat >> $HGRCPATH << EOF | $ cat >> $HGRCPATH << EOF | ||||
> [hooks] | > [hooks] | ||||
> prepushkey.failpush = | > prepushkey.failpush = | ||||
> EOF | > EOF | ||||
$ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config | ||||
$ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log | $ hg serve -R other -p $HGPORT2 -d --pid-file=other.pid -E other-error.log |