Patchwork D5447: test: adding test of issue4700

login
register
mail settings
Submitter phabricator
Date Dec. 19, 2018, 1:31 p.m.
Message ID <4c6d635ee66e2fa01664e098206d51f7@localhost.localdomain>
Download mbox | patch
Permalink /patch/37238/
State Not Applicable
Headers show

Comments

phabricator - Dec. 19, 2018, 1:31 p.m.
valentin.gatienbaron updated this revision to Diff 12894.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5447?vs=12891&id=12894

REVISION DETAIL
  https://phab.mercurial-scm.org/D5447

AFFECTED FILES
  tests/test-bookmarks-pushpull.t

CHANGE DETAILS




To: valentin.gatienbaron, #hg-reviewers
Cc: yuja, mercurial-devel
Yuya Nishihara - Dec. 20, 2018, 1:05 p.m.
Queued this, thanks.
phabricator - Dec. 20, 2018, 1:24 p.m.
yuja added a comment.


  Queued this, thanks.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5447

To: valentin.gatienbaron, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -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('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