.clang-format
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 24 Feb 2018 12:22:20 -0800
changeset 36524 bfe38f787d5b
parent 36224 d0a3fa849cb8
permissions -rw-r--r--
util: add a file object proxy that can notify observers There are various places in Mercurial where we may want to instrument low-level I/O. The use cases I can think of all involve development-type activities like monitoring the raw bytes passing through a file (for testing and debugging), counting the number of I/O function calls (for performance monitoring), and changing the behavior of I/O function calls (e.g. simulating a failure) (to facilitate testing). This commit invents a mechanism to wrap a file object so we can observe activity on it. We have similar functionality in badserverext.py. But that's a test-only extension and is pretty specific to the HTTP server. I would like a mechanism in core that is sufficiently generic so it can be used by multiple consumers, including `hg debug*` commands. The added code consists of a proxy type for file objects. It is bound to an "observer," which receives callbacks whenever I/O methods are called. We also add an implementation of an observer that logs specific I/O events. This observer will be used in an upcoming commit to record low-level wire protocol activity. A helper function to convert a file object into an observed file object has also been implemented. I don't anticipate any critical functionality in core using these types. So I don't think explicit test coverage is worth implementing. Differential Revision: https://phab.mercurial-scm.org/D2462
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34798
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     1
BasedOnStyle: LLVM
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     2
IndentWidth: 8
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     3
UseTab: ForIndentation
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     4
BreakBeforeBraces: Linux
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     5
AllowShortIfStatementsOnASingleLine: false
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     6
IndentCaseLabels: false
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     7
AllowShortBlocksOnASingleLine: false
e33381d95930 clang-format: configuration for the clang-format source formatter
Augie Fackler <raf@durin42.com>
parents:
diff changeset
     8
AllowShortFunctionsOnASingleLine: false
36224
d0a3fa849cb8 formatting: enforce system headers before local headers
Augie Fackler <augie@google.com>
parents: 34798
diff changeset
     9
IncludeCategories:
d0a3fa849cb8 formatting: enforce system headers before local headers
Augie Fackler <augie@google.com>
parents: 34798
diff changeset
    10
  - Regex:           '^<'
d0a3fa849cb8 formatting: enforce system headers before local headers
Augie Fackler <augie@google.com>
parents: 34798
diff changeset
    11
    Priority:        1
d0a3fa849cb8 formatting: enforce system headers before local headers
Augie Fackler <augie@google.com>
parents: 34798
diff changeset
    12
  - Regex:           '^"'
d0a3fa849cb8 formatting: enforce system headers before local headers
Augie Fackler <augie@google.com>
parents: 34798
diff changeset
    13
    Priority:        2