##// END OF EJS Templates
chg: show timestamp with debug messages...
Jun Wu -
r34310:b94db178 default
parent child Browse files
Show More
@@ -14,6 +14,7 b''
14 #include <stdio.h>
14 #include <stdio.h>
15 #include <stdlib.h>
15 #include <stdlib.h>
16 #include <string.h>
16 #include <string.h>
17 #include <sys/time.h>
17 #include <sys/types.h>
18 #include <sys/types.h>
18 #include <sys/wait.h>
19 #include <sys/wait.h>
19 #include <unistd.h>
20 #include <unistd.h>
@@ -59,6 +60,13 b' void abortmsgerrno(const char *fmt, ...)'
59 }
60 }
60
61
61 static int debugmsgenabled = 0;
62 static int debugmsgenabled = 0;
63 static double debugstart = 0;
64
65 static double now() {
66 struct timeval t;
67 gettimeofday(&t, NULL);
68 return t.tv_usec / 1e6 + t.tv_sec;
69 }
62
70
63 void enablecolor(void)
71 void enablecolor(void)
64 {
72 {
@@ -68,6 +76,7 b' void enablecolor(void)'
68 void enabledebugmsg(void)
76 void enabledebugmsg(void)
69 {
77 {
70 debugmsgenabled = 1;
78 debugmsgenabled = 1;
79 debugstart = now();
71 }
80 }
72
81
73 void debugmsg(const char *fmt, ...)
82 void debugmsg(const char *fmt, ...)
@@ -78,7 +87,7 b' void debugmsg(const char *fmt, ...)'
78 va_list args;
87 va_list args;
79 va_start(args, fmt);
88 va_start(args, fmt);
80 fsetcolor(stderr, "1;30");
89 fsetcolor(stderr, "1;30");
81 fputs("chg: debug: ", stderr);
90 fprintf(stderr, "chg: debug: %4.6f ", now() - debugstart);
82 vfprintf(stderr, fmt, args);
91 vfprintf(stderr, fmt, args);
83 fsetcolor(stderr, "");
92 fsetcolor(stderr, "");
84 fputc('\n', stderr);
93 fputc('\n', stderr);
@@ -48,7 +48,7 b' by default, system() should be redirecte'
48 $ touch foo
48 $ touch foo
49 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
49 $ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
50 > | egrep "HG:|run 'cat"
50 > | egrep "HG:|run 'cat"
51 chg: debug: run 'cat "*"' at '$TESTTMP/editor' (glob)
51 chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
52 HG: Enter commit message. Lines beginning with 'HG:' are removed.
52 HG: Enter commit message. Lines beginning with 'HG:' are removed.
53 HG: Leave message empty to abort commit.
53 HG: Leave message empty to abort commit.
54 HG: --
54 HG: --
@@ -165,16 +165,16 b' isolate socket directory for stable resu'
165 warm up server:
165 warm up server:
166
166
167 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
167 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
168 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
168 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
169
169
170 new server should be started if extension modified:
170 new server should be started if extension modified:
171
171
172 $ sleep 1
172 $ sleep 1
173 $ touch dummyext.py
173 $ touch dummyext.py
174 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
174 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
175 chg: debug: instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
175 chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
176 chg: debug: instruction: reconnect
176 chg: debug: * instruction: reconnect (glob)
177 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
177 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
178
178
179 old server will shut down, while new server should still be reachable:
179 old server will shut down, while new server should still be reachable:
180
180
@@ -196,7 +196,7 b' since no server is reachable from socket'
196 (this test makes sure that old server shut down automatically)
196 (this test makes sure that old server shut down automatically)
197
197
198 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
198 $ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
199 chg: debug: start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
199 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
200
200
201 shut down servers and restore environment:
201 shut down servers and restore environment:
202
202
General Comments 0
You need to be logged in to leave comments. Login now