diff --git a/hgext/keyword.py b/hgext/keyword.py index 5b1d406b39f15a3c3fe1718c8201300043a617e1_aGdleHQva2V5d29yZC5weQ==..34ba47117164318716d93840d9dda21f5b77e336_aGdleHQva2V5d29yZC5weQ== 100644 --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -576,8 +576,8 @@ label = 'kwfiles.' + kwstate for f in filenames: fm.startitem() - fm.write('kwstatus path', fmt, char, - repo.pathto(f, cwd), label=label) + fm.data(kwstatus=char, path=f) + fm.plain(fmt % (char, repo.pathto(f, cwd)), label=label) fm.end() @command('kwshrink', diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py index 5b1d406b39f15a3c3fe1718c8201300043a617e1_bWVyY3VyaWFsL2NtZHV0aWwucHk=..34ba47117164318716d93840d9dda21f5b77e336_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644 --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2176,8 +2176,8 @@ if needsfctx: fc = ctx[f] fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) - fm.data(abspath=f) - fm.write('path', fmt, m.rel(f)) + fm.data(path=f) + fm.plain(fmt % m.rel(f)) ret = 0 for subpath in sorted(ctx.substate): @@ -2323,7 +2323,7 @@ fm.startitem() fm.context(ctx=ctx) fm.write('data', '%s', data) - fm.data(abspath=path, path=matcher.rel(path)) + fm.data(path=path) def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts): err = 1 diff --git a/mercurial/commands.py b/mercurial/commands.py index 5b1d406b39f15a3c3fe1718c8201300043a617e1_bWVyY3VyaWFsL2NvbW1hbmRzLnB5..34ba47117164318716d93840d9dda21f5b77e336_bWVyY3VyaWFsL2NvbW1hbmRzLnB5 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -337,6 +337,6 @@ ('rev', ' ', lambda x: x.fctx.rev(), formatrev), ('node', ' ', lambda x: hexfn(x.fctx.node()), formathex), ('date', ' ', lambda x: x.fctx.date(), util.cachefunc(datefunc)), - ('file', ' ', lambda x: x.fctx.path(), pycompat.bytestr), + ('path', ' ', lambda x: x.fctx.path(), pycompat.bytestr), ('line_number', ':', lambda x: x.lineno, pycompat.bytestr), ] @@ -341,6 +341,6 @@ ('line_number', ':', lambda x: x.lineno, pycompat.bytestr), ] - opnamemap = {'rev': 'number', 'node': 'changeset'} + opnamemap = {'rev': 'number', 'node': 'changeset', 'path': 'file'} if (not opts.get('user') and not opts.get('changeset') and not opts.get('date') and not opts.get('file')): @@ -380,7 +380,7 @@ for abs in ctx.walk(m): fctx = ctx[abs] rootfm.startitem() - rootfm.data(abspath=abs, path=m.rel(abs)) + rootfm.data(path=abs) if not opts.get('text') and fctx.isbinary(): rootfm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) @@ -2660,7 +2660,7 @@ except error.WdirUnsupported: return ctx[fn].isbinary() - fieldnamemap = {'filename': 'file', 'linenumber': 'line_number'} + fieldnamemap = {'filename': 'path', 'linenumber': 'line_number'} if diff: iter = difflinestates(pstates, states) else: @@ -5187,4 +5187,5 @@ for f in files: fm.startitem() fm.context(ctx=ctx2) + fm.data(path=f) fm.condwrite(showchar, 'status', '%s ', char, label=label) @@ -5190,3 +5191,3 @@ fm.condwrite(showchar, 'status', '%s ', char, label=label) - fm.write('path', fmt, repo.pathto(f, cwd), label=label) + fm.plain(fmt % repo.pathto(f, cwd), label=label) if f in copy: @@ -5192,5 +5193,6 @@ if f in copy: - fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), + fm.data(copy=copy[f]) + fm.plain((' %s' + end) % repo.pathto(copy[f], cwd), label='status.copied') if ((ui.verbose or ui.configbool('commands', 'status.verbose')) diff --git a/mercurial/templates/map-cmdline.default b/mercurial/templates/map-cmdline.default index 5b1d406b39f15a3c3fe1718c8201300043a617e1_bWVyY3VyaWFsL3RlbXBsYXRlcy9tYXAtY21kbGluZS5kZWZhdWx0..34ba47117164318716d93840d9dda21f5b77e336_bWVyY3VyaWFsL3RlbXBsYXRlcy9tYXAtY21kbGluZS5kZWZhdWx0 100644 --- a/mercurial/templates/map-cmdline.default +++ b/mercurial/templates/map-cmdline.default @@ -74,7 +74,7 @@ {label('ui.note log.description', '{desc|strip}')}\n\n")}' -status = '{status} {path}\n{if(copy, " {copy}\n")}' +status = '{status} {path|relpath}\n{if(copy, " {copy|relpath}\n")}' # Obsfate templates, it would be removed once we introduce the obsfate # template fragment diff --git a/tests/test-annotate.t b/tests/test-annotate.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1hbm5vdGF0ZS50..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1hbm5vdGF0ZS50 100644 --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -56,7 +56,6 @@ $ hg annotate -Tjson a [ { - "abspath": "a", "lines": [{"line": "a\n", "rev": 0}], "path": "a" } @@ -65,8 +64,7 @@ $ hg annotate -Tjson -cdfnul a [ { - "abspath": "a", - "lines": [{"date": [1.0, 0], "file": "a", "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "rev": 0, "user": "nobody"}], + "lines": [{"date": [1.0, 0], "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}], "path": "a" } ] @@ -127,8 +125,7 @@ $ hg annotate -Tjson a b [ { - "abspath": "a", "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}], "path": "a" }, { @@ -131,8 +128,7 @@ "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}], "path": "a" }, { - "abspath": "b", "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}], "path": "b" } @@ -140,7 +136,7 @@ annotate multiple files (template) - $ hg annotate -T'== {abspath} ==\n{lines % "{rev}: {line}"}' a b + $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b == a == 0: a 1: a @@ -568,7 +564,6 @@ $ hg annotate -ncr "wdir()" -Tjson foo [ { - "abspath": "foo", "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": null, "rev": null}], "path": "foo" } @@ -870,7 +865,6 @@ $ hg annotate -Tjson binary empty [ { - "abspath": "binary", "path": "binary" }, { @@ -874,7 +868,6 @@ "path": "binary" }, { - "abspath": "empty", "lines": [], "path": "empty" } diff --git a/tests/test-cat.t b/tests/test-cat.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1jYXQudA==..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1jYXQudA== 100644 --- a/tests/test-cat.t +++ b/tests/test-cat.t @@ -65,7 +65,7 @@ Test template output - $ hg --cwd tmp cat ../b ../c -T '== {path} ({abspath}) r{rev} ==\n{data}' + $ hg --cwd tmp cat ../b ../c -T '== {path|relpath} ({path}) r{rev} ==\n{data}' == ../b (b) r2 == 1 == ../c (c) r2 == @@ -74,8 +74,7 @@ $ hg cat b c -Tjson --output - [ { - "abspath": "b", "data": "1\n", "path": "b" }, { @@ -78,8 +77,7 @@ "data": "1\n", "path": "b" }, { - "abspath": "c", "data": "3\n", "path": "c" } @@ -89,7 +87,6 @@ $ cat tmp/b.json [ { - "abspath": "b", "data": "1\n", "path": "b" } @@ -97,7 +94,6 @@ $ cat tmp/c.json [ { - "abspath": "c", "data": "3\n", "path": "c" } diff --git a/tests/test-fastannotate-hg.t b/tests/test-fastannotate-hg.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1mYXN0YW5ub3RhdGUtaGcudA==..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1mYXN0YW5ub3RhdGUtaGcudA== 100644 --- a/tests/test-fastannotate-hg.t +++ b/tests/test-fastannotate-hg.t @@ -69,7 +69,6 @@ $ hg annotate -Tjson a [ { - "abspath": "a", "lines": [{"line": "a\n", "rev": 0}], "path": "a" } @@ -78,8 +77,7 @@ $ hg annotate -Tjson -cdfnul a [ { - "abspath": "a", - "lines": [{"date": [1.0, 0], "file": "a", "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "rev": 0, "user": "nobody"}], + "lines": [{"date": [1.0, 0], "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}], "path": "a" } ] @@ -571,7 +569,6 @@ $ hg annotate -ncr "wdir()" -Tjson foo [ { - "abspath": "foo", "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": null, "rev": null}], "path": "foo" } diff --git a/tests/test-grep.t b/tests/test-grep.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1ncmVwLnQ=..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1ncmVwLnQ= 100644 --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -43,8 +43,8 @@ simple templated $ hg grep port -r tip:0 \ - > -T '{file}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n' + > -T '{path}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n' port:4:914fa752cdea:exPORT port:4:914fa752cdea:vaPORTight port:4:914fa752cdea:imPORT/exPORT @@ -47,9 +47,9 @@ port:4:914fa752cdea:exPORT port:4:914fa752cdea:vaPORTight port:4:914fa752cdea:imPORT/exPORT - $ hg grep port -r tip:0 -T '{file}:{rev}:{texts}\n' + $ hg grep port -r tip:0 -T '{path}:{rev}:{texts}\n' port:4:export port:4:vaportight port:4:import/export @@ -52,8 +52,8 @@ port:4:export port:4:vaportight port:4:import/export - $ hg grep port -r tip:0 -T '{file}:{tags}:{texts}\n' + $ hg grep port -r tip:0 -T '{path}:{tags}:{texts}\n' port:tip:export port:tip:vaportight port:tip:import/export @@ -64,6 +64,5 @@ [ { "date": [4, 0], - "file": "port", "line_number": 1, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", @@ -68,8 +67,9 @@ "line_number": 1, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", + "path": "port", "rev": 4, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], "user": "spam" }, { "date": [4, 0], @@ -70,9 +70,8 @@ "rev": 4, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], "user": "spam" }, { "date": [4, 0], - "file": "port", "line_number": 2, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", @@ -77,8 +76,9 @@ "line_number": 2, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", + "path": "port", "rev": 4, "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}], "user": "spam" }, { "date": [4, 0], @@ -79,9 +79,8 @@ "rev": 4, "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}], "user": "spam" }, { "date": [4, 0], - "file": "port", "line_number": 3, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", @@ -86,5 +85,6 @@ "line_number": 3, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", + "path": "port", "rev": 4, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}], "user": "spam" @@ -97,6 +97,5 @@ [ { "date": [4, 0], - "file": "port", "line_number": 1, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", @@ -101,5 +100,6 @@ "line_number": 1, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", + "path": "port", "rev": 4, "user": "spam" } @@ -125,6 +125,5 @@ { "change": "-", "date": [4, 0], - "file": "port", "line_number": 4, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", @@ -129,5 +128,6 @@ "line_number": 4, "node": "914fa752cdea87777ac1a8d5c858b0c736218f6c", + "path": "port", "rev": 4, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}], "user": "spam" @@ -135,6 +135,5 @@ { "change": "+", "date": [3, 0], - "file": "port", "line_number": 4, "node": "95040cfd017d658c536071c6290230a613c4c2a6", @@ -139,5 +138,6 @@ "line_number": 4, "node": "95040cfd017d658c536071c6290230a613c4c2a6", + "path": "port", "rev": 3, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}], "user": "eggs" @@ -145,6 +145,5 @@ { "change": "-", "date": [2, 0], - "file": "port", "line_number": 1, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", @@ -149,5 +148,6 @@ "line_number": 1, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", + "path": "port", "rev": 2, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}], "user": "spam" @@ -155,6 +155,5 @@ { "change": "-", "date": [2, 0], - "file": "port", "line_number": 2, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", @@ -159,5 +158,6 @@ "line_number": 2, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", + "path": "port", "rev": 2, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], "user": "spam" @@ -165,6 +165,5 @@ { "change": "+", "date": [2, 0], - "file": "port", "line_number": 1, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", @@ -169,5 +168,6 @@ "line_number": 1, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", + "path": "port", "rev": 2, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], "user": "spam" @@ -175,6 +175,5 @@ { "change": "+", "date": [2, 0], - "file": "port", "line_number": 2, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", @@ -179,5 +178,6 @@ "line_number": 2, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", + "path": "port", "rev": 2, "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}], "user": "spam" @@ -185,6 +185,5 @@ { "change": "+", "date": [2, 0], - "file": "port", "line_number": 3, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", @@ -189,5 +188,6 @@ "line_number": 3, "node": "3b325e3481a1f07435d81dfdbfa434d9a0245b47", + "path": "port", "rev": 2, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}], "user": "spam" @@ -195,6 +195,5 @@ { "change": "+", "date": [1, 0], - "file": "port", "line_number": 2, "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587", @@ -199,5 +198,6 @@ "line_number": 2, "node": "8b20f75c158513ff5ac80bd0e5219bfb6f0eb587", + "path": "port", "rev": 1, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], "user": "eggs" @@ -205,6 +205,5 @@ { "change": "+", "date": [0, 0], - "file": "port", "line_number": 1, "node": "f31323c9217050ba245ee8b537c713ec2e8ab226", @@ -209,5 +208,6 @@ "line_number": 1, "node": "f31323c9217050ba245ee8b537c713ec2e8ab226", + "path": "port", "rev": 0, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}], "user": "spam" @@ -481,6 +481,5 @@ [ { "date": [0, 0], - "file": "file2", "line_number": 1, "node": "ffffffffffffffffffffffffffffffffffffffff", @@ -485,5 +484,6 @@ "line_number": 1, "node": "ffffffffffffffffffffffffffffffffffffffff", + "path": "file2", "rev": 2147483647, "texts": [{"matched": true, "text": "some"}, {"matched": false, "text": " text"}], "user": "test" diff --git a/tests/test-locate.t b/tests/test-locate.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1sb2NhdGUudA==..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1sb2NhdGUudA== 100644 --- a/tests/test-locate.t +++ b/tests/test-locate.t @@ -158,7 +158,7 @@ Convert native path separator to slash (issue5572) - $ hg files -T '{path|slashpath}\n' + $ hg files -T '{path|relpath|slashpath}\n' ../b ../dir.h/foo ../t.h diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t index 5b1d406b39f15a3c3fe1718c8201300043a617e1_dGVzdHMvdGVzdC1zdWJyZXBvLnQ=..34ba47117164318716d93840d9dda21f5b77e336_dGVzdHMvdGVzdC1zdWJyZXBvLnQ= 100644 --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -1066,5 +1066,4 @@ $ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g' [ { - "abspath": "foo", "data": "test\ntest\n", @@ -1070,7 +1069,7 @@ "data": "test\ntest\n", - "path": "sub/repo/foo" + "path": "foo" } ] non-exact match: @@ -1072,9 +1071,9 @@ } ] non-exact match: - $ hg cat -T '{path}\n' 'glob:**' + $ hg cat -T '{path|relpath}\n' 'glob:**' .hgsub .hgsubstate sub/repo/foo @@ -1078,7 +1077,7 @@ .hgsub .hgsubstate sub/repo/foo - $ hg cat -T '{path}\n' 're:^sub' + $ hg cat -T '{path|relpath}\n' 're:^sub' sub/repo/foo missing subrepos in working directory: