Show More
@@ -37,6 +37,11 b' parser.add_argument(' | |||||
37 | parser.add_argument( |
|
37 | parser.add_argument( | |
38 | "out", nargs="?", default=None, help="where to write the output" |
|
38 | "out", nargs="?", default=None, help="where to write the output" | |
39 | ) |
|
39 | ) | |
|
40 | parser.add_argument( | |||
|
41 | "--line", | |||
|
42 | action="store_true", | |||
|
43 | help="print environment variables one per line instead of on a single line", | |||
|
44 | ) | |||
40 | args = parser.parse_args() |
|
45 | args = parser.parse_args() | |
41 |
|
46 | |||
42 | if args.out is None: |
|
47 | if args.out is None: | |
@@ -56,9 +61,18 b" if os.name == 'nt':" | |||||
56 | filter = lambda x: x.replace('\\', '/') |
|
61 | filter = lambda x: x.replace('\\', '/') | |
57 | else: |
|
62 | else: | |
58 | filter = lambda x: x |
|
63 | filter = lambda x: x | |
|
64 | ||||
59 | vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii')) |
|
65 | vars = [b"%s=%s" % (k.encode('ascii'), filter(v).encode('ascii')) | |
60 | for k, v in env] |
|
66 | for k, v in env] | |
|
67 | ||||
|
68 | # Print variables on out | |||
|
69 | if not args.line: | |||
61 | out.write(b" ".join(vars)) |
|
70 | out.write(b" ".join(vars)) | |
|
71 | else: | |||
|
72 | for var in vars: | |||
|
73 | out.write(var) | |||
|
74 | out.write(b"\n") | |||
|
75 | ||||
62 | out.write(b"\n") |
|
76 | out.write(b"\n") | |
63 | out.close() |
|
77 | out.close() | |
64 |
|
78 |
@@ -140,7 +140,7 b' pull' | |||||
140 | $ cd copy-pull |
|
140 | $ cd copy-pull | |
141 | $ cat >> .hg/hgrc <<EOF |
|
141 | $ cat >> .hg/hgrc <<EOF | |
142 | > [hooks] |
|
142 | > [hooks] | |
143 | > changegroup = sh -c "printenv.py changegroup" |
|
143 | > changegroup = sh -c "printenv.py --line changegroup" | |
144 | > EOF |
|
144 | > EOF | |
145 | $ hg pull |
|
145 | $ hg pull | |
146 | pulling from http://localhost:$HGPORT1/ |
|
146 | pulling from http://localhost:$HGPORT1/ | |
@@ -150,7 +150,14 b' pull' | |||||
150 | adding file changes |
|
150 | adding file changes | |
151 | added 1 changesets with 1 changes to 1 files |
|
151 | added 1 changesets with 1 changes to 1 files | |
152 | new changesets 5fed3813f7f5 |
|
152 | new changesets 5fed3813f7f5 | |
153 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/ |
|
153 | changegroup hook: HG_HOOKNAME=changegroup | |
|
154 | HG_HOOKTYPE=changegroup | |||
|
155 | HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d | |||
|
156 | HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d | |||
|
157 | HG_SOURCE=pull | |||
|
158 | HG_TXNID=TXN:$ID$ | |||
|
159 | HG_URL=http://localhost:$HGPORT1/ | |||
|
160 | ||||
154 | (run 'hg update' to get a working copy) |
|
161 | (run 'hg update' to get a working copy) | |
155 | $ cd .. |
|
162 | $ cd .. | |
156 |
|
163 |
General Comments 0
You need to be logged in to leave comments.
Login now