Mercurial > hg > mercurial-crew-with-dirclash
comparison tests/printenv.py @ 4643:a39cec1d5cb8
printenv: filter empty environment variables for portability.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 20 Jun 2007 22:06:37 +0200 |
parents | 4fd6f7e60894 |
children | 7a7d4937272b |
comparison
equal
deleted
inserted
replaced
4642:7c5428853566 | 4643:a39cec1d5cb8 |
---|---|
23 if len(sys.argv) > 2: | 23 if len(sys.argv) > 2: |
24 exitcode = int(sys.argv[2]) | 24 exitcode = int(sys.argv[2]) |
25 if len(sys.argv) > 3: | 25 if len(sys.argv) > 3: |
26 out = open(sys.argv[3], "ab") | 26 out = open(sys.argv[3], "ab") |
27 | 27 |
28 env = [v for v in os.environ if v.startswith("HG_")] | 28 # variables with empty values may not exist on all platforms, filter |
29 # them now for portability sake. | |
30 env = [k for k,v in os.environ.iteritems() | |
31 if k.startswith("HG_") and v] | |
29 env.sort() | 32 env.sort() |
30 | 33 |
31 # edit the variable part of the variable | 34 # edit the variable part of the variable |
32 url = os.environ.get("HG_URL", "") | 35 url = os.environ.get("HG_URL", "") |
33 if url.startswith("file:"): | 36 if url.startswith("file:"): |