Mercurial > hg
annotate contrib/debugcmdserver.py @ 19966:7985e3469f58 stable
largefiles: systematic testing of merges to/from largefiles
427ce5633c1c fixed one problem with update and added a test case for it. The
test coverage was thus insufficient before that.
To make sure we have good test coverage in this area we add systematic testing
of all cases of merges that may or may not change normal files to largefiles or
vice versa.
The tests shows some annoying extra merge prompts in some cases, but these
prompts are hard to avoid and they are now "safe" - they do not leave the
system in a confused inconsistent state.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 28 Oct 2013 22:34:05 +0100 |
parents | e34106fa0dc3 |
children | cd03fbd5ab57 |
rev | line source |
---|---|
15259
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 # |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 # Dumps output generated by Mercurial's command server in a formatted style to a |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 # given file or stderr if '-' is specified. Output is also written in its raw |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 # format to stdout. |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 # |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 # $ ./hg serve --cmds pipe | ./contrib/debugcmdserver.py - |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 # o, 52 -> 'capabilities: getencoding runcommand\nencoding: UTF-8' |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
10 import sys, struct |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
11 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
12 if len(sys.argv) != 2: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
13 print 'usage: debugcmdserver.py FILE' |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
14 sys.exit(1) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
15 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
16 outputfmt = '>cI' |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
17 outputfmtsize = struct.calcsize(outputfmt) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
18 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
19 if sys.argv[1] == '-': |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
20 log = sys.stderr |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
21 else: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
22 log = open(sys.argv[1], 'a') |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
23 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
24 def read(size): |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
25 data = sys.stdin.read(size) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
26 if not data: |
16687
e34106fa0dc3
cleanup: "raise SomeException()" -> "raise SomeException"
Brodie Rao <brodie@sf.io>
parents:
15259
diff
changeset
|
27 raise EOFError |
15259
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
28 sys.stdout.write(data) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
29 sys.stdout.flush() |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
30 return data |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
31 |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
32 try: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
33 while True: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
34 header = read(outputfmtsize) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
35 channel, length = struct.unpack(outputfmt, header) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
36 log.write('%s, %-4d' % (channel, length)) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
37 if channel in 'IL': |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
38 log.write(' -> waiting for input\n') |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
39 else: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
40 data = read(length) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
41 log.write(' -> %r\n' % data) |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
42 log.flush() |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
43 except EOFError: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
44 pass |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
45 finally: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
46 if log != sys.stderr: |
1d1f6dff9364
contrib: add a script to help diagnose raw output of the cmdserver
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
47 log.close() |