tests/test-chg.t
branchstable
changeset 50725 7e5be4a7cda7
parent 50353 c2a1f8668606
child 51389 db5d7aee641e
equal deleted inserted replaced
50724:a10d823a8e3d 50725:7e5be4a7cda7
    68 
    68 
    69 by default, system() should be redirected to the client:
    69 by default, system() should be redirected to the client:
    70 
    70 
    71   $ touch foo
    71   $ touch foo
    72   $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
    72   $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
    73   > | egrep "HG:|run 'cat"
    73   > | grep -E "HG:|run 'cat"
    74   chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
    74   chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
    75   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
    75   HG: Enter commit message.  Lines beginning with 'HG:' are removed.
    76   HG: Leave message empty to abort commit.
    76   HG: Leave message empty to abort commit.
    77   HG: --
    77   HG: --
    78   HG: user: test
    78   HG: user: test
    82 but no redirection should be made if output is captured:
    82 but no redirection should be made if output is captured:
    83 
    83 
    84   $ touch bar
    84   $ touch bar
    85   $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
    85   $ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
    86   > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
    86   > --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
    87   > | egrep "HG:|run 'cat"
    87   > | grep -E "HG:|run 'cat"
    88   [1]
    88   [1]
    89 
    89 
    90 check that commit commands succeeded:
    90 check that commit commands succeeded:
    91 
    91 
    92   $ hg log -T '{rev}:{desc}\n'
    92   $ hg log -T '{rev}:{desc}\n'
   235   $ mkdir chgsock
   235   $ mkdir chgsock
   236   $ CHGSOCKNAME=`pwd`/chgsock/server
   236   $ CHGSOCKNAME=`pwd`/chgsock/server
   237 
   237 
   238 warm up server:
   238 warm up server:
   239 
   239 
   240   $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
   240   $ CHGDEBUG= chg log 2>&1 | grep -E 'instruction|start'
   241   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   241   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   242 
   242 
   243 new server should be started if extension modified:
   243 new server should be started if extension modified:
   244 
   244 
   245   $ sleep 1
   245   $ sleep 1
   246   $ touch dummyext.py
   246   $ touch dummyext.py
   247   $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
   247   $ CHGDEBUG= chg log 2>&1 | grep -E 'instruction|start'
   248   chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
   248   chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
   249   chg: debug: * instruction: reconnect (glob)
   249   chg: debug: * instruction: reconnect (glob)
   250   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   250   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   251 
   251 
   252 old server will shut down, while new server should still be reachable:
   252 old server will shut down, while new server should still be reachable:
   253 
   253 
   254   $ sleep 2
   254   $ sleep 2
   255   $ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true)
   255   $ CHGDEBUG= chg log 2>&1 | (grep -E 'instruction|start' || true)
   256 
   256 
   257 socket file should never be unlinked by old server:
   257 socket file should never be unlinked by old server:
   258 (simulates unowned socket by updating mtime, which makes sure server exits
   258 (simulates unowned socket by updating mtime, which makes sure server exits
   259 at polling cycle)
   259 at polling cycle)
   260 
   260 
   266   chgsock/server-* (glob)
   266   chgsock/server-* (glob)
   267 
   267 
   268 since no server is reachable from socket file, new server should be started:
   268 since no server is reachable from socket file, new server should be started:
   269 (this test makes sure that old server shut down automatically)
   269 (this test makes sure that old server shut down automatically)
   270 
   270 
   271   $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
   271   $ CHGDEBUG= chg log 2>&1 | grep -E 'instruction|start'
   272   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   272   chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
   273 
   273 
   274 shut down servers and restore environment:
   274 shut down servers and restore environment:
   275 
   275 
   276   $ rm -R chgsock
   276   $ rm -R chgsock
   493   $ filteredchg() {
   493   $ filteredchg() {
   494   >   CHGDEBUG=1 chg "$@" 2>&1 | sed -rn 's_^No samples recorded.*$_Sample count: 0_; /Sample count/p; /start cmdserver/p'
   494   >   CHGDEBUG=1 chg "$@" 2>&1 | sed -rn 's_^No samples recorded.*$_Sample count: 0_; /Sample count/p; /start cmdserver/p'
   495   > }
   495   > }
   496   $ newchg() {
   496   $ newchg() {
   497   >   chg --kill-chg-daemon
   497   >   chg --kill-chg-daemon
   498   >   filteredchg "$@" | egrep -v 'start cmdserver' || true
   498   >   filteredchg "$@" | grep -E -v 'start cmdserver' || true
   499   > }
   499   > }
   500 (--profile isn't permanently on just because it was specified when chg was
   500 (--profile isn't permanently on just because it was specified when chg was
   501 started)
   501 started)
   502   $ newchg log -r . --profile
   502   $ newchg log -r . --profile
   503   Sample count: * (glob)
   503   Sample count: * (glob)
   559 
   559 
   560 If CHGHG is not set, chg will set it before spawning the command server.
   560 If CHGHG is not set, chg will set it before spawning the command server.
   561   $ hg --kill-chg-daemon
   561   $ hg --kill-chg-daemon
   562   $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
   562   $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
   563   >   'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
   563   >   'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
   564   >   | egrep 'CHGHG|start'
   564   >   | grep -E 'CHGHG|start'
   565   chg: debug: * start cmdserver at * (glob)
   565   chg: debug: * start cmdserver at * (glob)
   566   CHGHG=/*/install/bin/hg (glob)
   566   CHGHG=/*/install/bin/hg (glob)
   567 
   567 
   568 Running the same command a second time shouldn't spawn a new command server.
   568 Running the same command a second time shouldn't spawn a new command server.
   569   $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
   569   $ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
   570   >   'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
   570   >   'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
   571   >   | egrep 'CHGHG|start'
   571   >   | grep -E 'CHGHG|start'
   572   CHGHG=/*/install/bin/hg (glob)
   572   CHGHG=/*/install/bin/hg (glob)