This is an archive of the discontinued Mercurial Phabricator instance.

test: introduce a new flag to display env variable line per line
ClosedPublic

Authored by lothiraldan on Dec 19 2018, 11:25 AM.

Details

Summary

It's easier to conditionalize some of the environment variables per Mercurial
version once there is only one value per line.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

lothiraldan created this revision.Dec 19 2018, 11:25 AM
yuja added a subscriber: yuja.Dec 20 2018, 8:00 AM

+parser.add_argument(
+ "--line",
+ action="store_const",
+ const=True,
+ default=False,

Nit: can be action="store_true"

vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii'))

for k, v in env]

-out.write(b" ".join(vars))
+
+# Print variables on out
+if args.line is False:

Nit: not args.line

+ vars = ["%s=%s" % (k, filter(v)) for k, v in env]

Why not reuse the vars constructed above? It's carefully written to be
Python3 safe.

In D5453#80871, @yuja wrote:

+parser.add_argument(
+ "--line",
+ action="store_const",
+ const=True,
+ default=False,

Nit: can be action="store_true"

vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii'))

for k, v in env]

-out.write(b" ".join(vars))
+
+# Print variables on out
+if args.line is False:

Nit: not args.line

Will update for the Nits

+ vars = ["%s=%s" % (k, filter(v)) for k, v in env]

Why not reuse the vars constructed above? It's carefully written to be
Python3 safe.

It's a bad resolution of a merge conflict, I will remote the line, nice catch

This revision was automatically updated to reflect the committed changes.