##// END OF EJS Templates
fix: add a -s option to format a revision and its descendants...
fix: add a -s option to format a revision and its descendants `hg fix -r abc123` will format that commit but not its descendants. That seems expected given the option name (`-r`), but it's very rarely what the user wants to do. The problem is that any descendants of that commit will not be formatted, leaving them as orphans that are hard to evolve. They are hard to evolve because the new parent will have formatting changes that the orphan doesn't have. I talked to Danny Hooper (who wrote most of the fix extension) about the problem and we agreed that deprecating `-r` in favor of a new `-s` argument (mimicing rebase's `-s`) would be a good way of reducing the risk that users end up with these hard-to-evolve orphans. So that's what this patch implements. Differential Revision: https://phab.mercurial-scm.org/D8287

File last commit:

r43346:2372284d default
r45064:5205b46b default
Show More
debugcmdserver.py
51 lines | 1.2 KiB | text/x-python | PythonLexer
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259 #!/usr/bin/env python
#
# Dumps output generated by Mercurial's command server in a formatted style to a
# given file or stderr if '-' is specified. Output is also written in its raw
# format to stdout.
#
# $ ./hg serve --cmds pipe | ./contrib/debugcmdserver.py -
# o, 52 -> 'capabilities: getencoding runcommand\nencoding: UTF-8'
Pulkit Goyal
debugcmdserver: use absolute_import and print_function
r28353 from __future__ import absolute_import, print_function
import struct
import sys
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259
if len(sys.argv) != 2:
Pulkit Goyal
debugcmdserver: use absolute_import and print_function
r28353 print('usage: debugcmdserver.py FILE')
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259 sys.exit(1)
outputfmt = '>cI'
outputfmtsize = struct.calcsize(outputfmt)
if sys.argv[1] == '-':
log = sys.stderr
else:
log = open(sys.argv[1], 'a')
Augie Fackler
formatting: blacken the codebase...
r43346
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259 def read(size):
data = sys.stdin.read(size)
if not data:
Brodie Rao
cleanup: "raise SomeException()" -> "raise SomeException"
r16687 raise EOFError
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259 sys.stdout.write(data)
sys.stdout.flush()
return data
Augie Fackler
formatting: blacken the codebase...
r43346
Idan Kamara
contrib: add a script to help diagnose raw output of the cmdserver
r15259 try:
while True:
header = read(outputfmtsize)
channel, length = struct.unpack(outputfmt, header)
log.write('%s, %-4d' % (channel, length))
if channel in 'IL':
log.write(' -> waiting for input\n')
else:
data = read(length)
log.write(' -> %r\n' % data)
log.flush()
except EOFError:
pass
finally:
if log != sys.stderr:
log.close()