debugstack: "foo_bar" -> "fooBar"

Summary: "fooBar" matches the Javascript style more closely.

Reviewed By: evangrayk

Differential Revision: D44231009

fbshipit-source-id: 9fcad73a8454044d573472f446e0d7ff7cb90d88
This commit is contained in:
Jun Wu 2023-03-27 10:39:27 -07:00 committed by Facebook GitHub Bot
parent 3377f02823
commit aeed9b3e47
2 changed files with 19 additions and 19 deletions

View File

@ -44,12 +44,12 @@ def debugexportstack(ui, repo, **opts):
"data": "utf-8 file content",
// Present if the file content is not utf-8.
"data_base85": "base85 encoded data",
"dataBase85": "base85 encoded data",
// Present if the file is copied from "path/from".
// The content of "path/from" will be included in "relevant_map"
// of the parent commits.
"copy_from": "path/from",
"copyFrom": "path/from",
// "l": symlink; "x": executable.
"flags": "",
@ -61,8 +61,8 @@ def debugexportstack(ui, repo, **opts):
// "files" render as the "after" state, "relevant_map" (in parent
// commits) render as the "before" state. If the file is already
// included in "files" of the parent commit, then it will be skipped
// in "relevant_files"
"relevant_files": {
// in "relevantFiles"
"relevantFiles": {
"foo/bar.txt": null | { ... }
...
},
@ -153,7 +153,7 @@ def debugexportstack(ui, repo, **opts):
}
relevant_files = relevant_map.get(node)
if relevant_files:
commit_obj["relevant_files"] = relevant_files
commit_obj["relevantFiles"] = relevant_files
if requested:
commit_obj["parents"] = [p.hex() for p in ctx.parents()]
commit_obj["files"] = requested_map[node]
@ -192,9 +192,9 @@ def _file_obj(ctx, path, set_copy_from=None, limiter=None):
try:
file_obj["data"] = bdata.decode("utf-8")
except UnicodeDecodeError:
file_obj["data_base85"] = base64.b85encode(bdata)
file_obj["dataBase85"] = base64.b85encode(bdata)
if copy_from_path:
file_obj["copy_from"] = copy_from_path
file_obj["copyFrom"] = copy_from_path
flags = fctx.flags()
if flags:
file_obj["flags"] = flags
@ -255,10 +255,10 @@ def debugimportstack(ui, repo, **opts):
"data": "utf-8 file content",
// The file content is encoded in base85.
"data_base85": "base85 encoded data",
"dataBase85": "base85 encoded data",
// Present if the file is copied from the parent commit.
"copy_from": "path/from",
"copyFrom": "path/from",
// "l": symlink; "x": executable.
"flags": "",
@ -270,7 +270,7 @@ def debugimportstack(ui, repo, **opts):
The format of "commit_info" is similar to the output of
``debugexportstack``, with some differences:
- No ``relevant_files``.
- No ``relevantFiles``.
- No ``node``. Use ``mark`` instead. ``parents`` can refer to marks.
- Has ``predecessors``.
@ -481,8 +481,8 @@ def _filectxfn(repo, mctx, path, files_dict):
if "data" in file_info:
data = file_info["data"].encode("utf-8")
else:
data = base64.b85decode(file_info["data_base85"])
copied = file_info.get("copy_from")
data = base64.b85decode(file_info["dataBase85"])
copied = file_info.get("copyFrom")
flags = file_info.get("flags", "")
return context.memfilectx(
repo,

View File

@ -54,28 +54,28 @@ Test that various code paths in debugexportstack are exercised:
with assertCovered(debugstack.debugexportstack):
# Regular export.
$ hg debugexportstack -r $B::$D | pprint
[{'author': 'test', 'date': [0.0, 0], 'immutable': True, 'node': '983f771099bbf84b42d0058f027b47ede52f179a', 'relevant_files': {'A': {'data': '1'}, 'B': None}, 'requested': False, 'text': 'A'},
[{'author': 'test', 'date': [0.0, 0], 'immutable': True, 'node': '983f771099bbf84b42d0058f027b47ede52f179a', 'relevantFiles': {'A': {'data': '1'}, 'B': None}, 'requested': False, 'text': 'A'},
{'author': 'test',
'date': [0.0, 0],
'files': {'A': {'data': '2'}, 'B': {'data': '3', 'flags': 'x'}},
'immutable': False,
'node': '8b5b077308ecdd37270b7b94d98d64d27c170dfb',
'parents': ['983f771099bbf84b42d0058f027b47ede52f179a'],
'relevant_files': {'C': None, 'Z': None},
'relevantFiles': {'C': None, 'Z': None},
'requested': True,
'text': 'B'},
{'author': 'test',
'date': [0.0, 0],
'files': {'C': {'data_base85': "b'`)v'"}, 'Z': {'data': 'B', 'flags': 'l'}},
'files': {'C': {'dataBase85': "b'`)v'"}, 'Z': {'data': 'B', 'flags': 'l'}},
'immutable': False,
'node': 'd2a2ca8387f2339934b6ce3fb17992433e06fdd4',
'parents': ['8b5b077308ecdd37270b7b94d98d64d27c170dfb'],
'relevant_files': {'A': {'data': '2'}, 'D': None, 'E': None},
'relevantFiles': {'A': {'data': '2'}, 'D': None, 'E': None},
'requested': True,
'text': 'C'},
{'author': 'test',
'date': [0.0, 0],
'files': {'A': None, 'D': {'copy_from': 'A', 'data': '2'}, 'E': {'copy_from': 'C', 'data': 'E'}},
'files': {'A': None, 'D': {'copyFrom': 'A', 'data': '2'}, 'E': {'copyFrom': 'C', 'data': 'E'}},
'immutable': False,
'node': 'f5086e168b2741946a5118463a8be38273822529',
'parents': ['d2a2ca8387f2339934b6ce3fb17992433e06fdd4'],
@ -107,9 +107,9 @@ Import stack:
> [["commit", {"author": "test1", "date": [3600, 3600], "text": "A", "mark": ":1", "parents": [],
> "files": {"A": {"data": "A"}}}],
> ["commit", {"author": "test2", "date": [7200, 0], "text": "B", "mark": ":2", "parents": [":1"],
> "files": {"B": {"data_base85": "LNN", "flags": "l"}}}],
> "files": {"B": {"dataBase85": "LNN", "flags": "l"}}}],
> ["commit", {"author": "test3", "date": [7200, -3600], "text": "C", "mark": ":3", "parents": [":2"],
> "files": {"A": null, "C": {"data": "C1", "copy_from": "A", "flags": "x"}}}],
> "files": {"A": null, "C": {"data": "C1", "copyFrom": "A", "flags": "x"}}}],
> ["goto", {"mark": ":3"}]
> ]
> EOS