changeset 41029:c236a491ab7b

test-bookmarks-pushpull: add failing test of issue4700 Differential Revision: https://phab.mercurial-scm.org/D5447
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Sun, 16 Dec 2018 00:21:54 -0500
parents 3c5aaea9638f
children 74e023f5a922
files tests/test-bookmarks-pushpull.t
diffstat 1 files changed, 53 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-bookmarks-pushpull.t	Wed Dec 19 15:42:20 2018 +0100
+++ b/tests/test-bookmarks-pushpull.t	Sun Dec 16 00:21:54 2018 -0500
@@ -609,13 +609,12 @@
   > # call.
   > listkeys.makecommit= sh $TESTTMP/listkeys_makecommit.sh
   > EOF
-
-(new config need server restart)
-
-  $ killdaemons.py
-  $ hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
-  $ cat ../pull-race.pid >> $DAEMON_PIDS
-
+  $ restart_server() {
+  >  "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  >  hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log
+  >  cat ../pull-race.pid >> $DAEMON_PIDS
+  > }
+  $ restart_server # new config need server restart
   $ hg -R $TESTTMP/pull-race book
      @                         1:0d2164f0ce0d
      X                         1:0d2164f0ce0d
@@ -640,6 +639,53 @@
    * Y                         5:35d1ef0a8d1b
      Z                         1:0d2164f0ce0d
 
+Update a bookmark right after the initial lookup -r (issue4700)
+
+  $ echo c7 > ../pull-race/f3 # to be committed during the race
+  $ cat <<EOF > ../lookuphook.py
+  > """small extensions adding a hook after wireprotocol lookup to test race"""
+  > import functools
+  > from mercurial import wireprotov1server, wireprotov2server
+  > 
+  > def wrappedlookup(orig, repo, *args, **kwargs):
+  >     ret = orig(repo, *args, **kwargs)
+  >     repo.hook(b'lookup')
+  >     return ret
+  > for table in [wireprotov1server.commands, wireprotov2server.COMMANDS]:
+  >   table[b'lookup'].func = functools.partial(wrappedlookup, table[b'lookup'].func)
+  > EOF
+  $ cat <<EOF > ../pull-race/.hg/hgrc
+  > [extensions]
+  > lookuphook=$TESTTMP/lookuphook.py
+  > [hooks]
+  > lookup.makecommit= sh $TESTTMP/listkeys_makecommit.sh
+  > EOF
+  $ restart_server # new config need server restart
+  $ hg -R $TESTTMP/pull-race book
+     @                         1:0d2164f0ce0d
+     X                         1:0d2164f0ce0d
+   * Y                         6:0d60821d2197
+     Z                         1:0d2164f0ce0d
+  $ hg pull -r Y
+  pulling from http://localhost:$HGPORT/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets 0d60821d2197 (1 drafts)
+  (run 'hg update' to get a working copy)
+  $ hg book
+     @                         1:0d2164f0ce0d
+     X                         1:0d2164f0ce0d
+   * Y                         5:35d1ef0a8d1b
+     Z                         1:0d2164f0ce0d
+  $ hg -R $TESTTMP/pull-race book
+     @                         1:0d2164f0ce0d
+     X                         1:0d2164f0ce0d
+   * Y                         7:714424d9e8b8
+     Z                         1:0d2164f0ce0d
+
 (done with this section of the test)
 
   $ killdaemons.py