Patchwork [4,of,7] grep: rename {line_number} to {lineno} as well (BC)

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 30, 2018, 1:43 p.m.
Message ID <22f0acc9d2d80ae870d9.1538315028@mimosa>
Download mbox | patch
Permalink /patch/35221/
State Superseded
Headers show

Comments

Yuya Nishihara - Sept. 30, 2018, 1:43 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1538289429 -32400
#      Sun Sep 30 15:37:09 2018 +0900
# Node ID 22f0acc9d2d80ae870d92636d9023b7849b616bb
# Parent  bed3e1312e6e620e6dc642a060bba6c88ee6c287
grep: rename {line_number} to {lineno} as well (BC)

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2680,7 +2680,7 @@  def grep(ui, repo, pattern, *pats, **opt
             except error.WdirUnsupported:
                 return ctx[fn].isbinary()
 
-        fieldnamemap = {'filename': 'path', 'linenumber': 'line_number'}
+        fieldnamemap = {'filename': 'path', 'linenumber': 'lineno'}
         if diff:
             iter = difflinestates(pstates, states)
         else:
diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -64,7 +64,7 @@  simple JSON (no "change" field)
   [
    {
     "date": [4, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
     "path": "port",
     "rev": 4,
@@ -73,7 +73,7 @@  simple JSON (no "change" field)
    },
    {
     "date": [4, 0],
-    "line_number": 2,
+    "lineno": 2,
     "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
     "path": "port",
     "rev": 4,
@@ -82,7 +82,7 @@  simple JSON (no "change" field)
    },
    {
     "date": [4, 0],
-    "line_number": 3,
+    "lineno": 3,
     "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
     "path": "port",
     "rev": 4,
@@ -97,7 +97,7 @@  simple JSON without matching lines
   [
    {
     "date": [4, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
     "path": "port",
     "rev": 4,
@@ -125,7 +125,7 @@  all JSON
    {
     "change": "-",
     "date": [4, 0],
-    "line_number": 4,
+    "lineno": 4,
     "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c",
     "path": "port",
     "rev": 4,
@@ -135,7 +135,7 @@  all JSON
    {
     "change": "+",
     "date": [3, 0],
-    "line_number": 4,
+    "lineno": 4,
     "node": "95040cfd017d658c536071c6290230a613c4c2a6",
     "path": "port",
     "rev": 3,
@@ -145,7 +145,7 @@  all JSON
    {
     "change": "-",
     "date": [2, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
     "path": "port",
     "rev": 2,
@@ -155,7 +155,7 @@  all JSON
    {
     "change": "-",
     "date": [2, 0],
-    "line_number": 2,
+    "lineno": 2,
     "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
     "path": "port",
     "rev": 2,
@@ -165,7 +165,7 @@  all JSON
    {
     "change": "+",
     "date": [2, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
     "path": "port",
     "rev": 2,
@@ -175,7 +175,7 @@  all JSON
    {
     "change": "+",
     "date": [2, 0],
-    "line_number": 2,
+    "lineno": 2,
     "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
     "path": "port",
     "rev": 2,
@@ -185,7 +185,7 @@  all JSON
    {
     "change": "+",
     "date": [2, 0],
-    "line_number": 3,
+    "lineno": 3,
     "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47",
     "path": "port",
     "rev": 2,
@@ -195,7 +195,7 @@  all JSON
    {
     "change": "+",
     "date": [1, 0],
-    "line_number": 2,
+    "lineno": 2,
     "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587",
     "path": "port",
     "rev": 1,
@@ -205,7 +205,7 @@  all JSON
    {
     "change": "+",
     "date": [0, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "f31323c9217050ba245ee8b537c713ec2e8ab226",
     "path": "port",
     "rev": 0,
@@ -481,7 +481,7 @@  but it should be available in template d
   [
    {
     "date": [0, 0],
-    "line_number": 1,
+    "lineno": 1,
     "node": "ffffffffffffffffffffffffffffffffffffffff",
     "path": "file2",
     "rev": 2147483647,