OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
6 | 6 |
7 import sys | 7 import sys |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import re | 10 import re |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return result.strip() | 64 return result.strip() |
65 | 65 |
66 def pull(self, repo): | 66 def pull(self, repo): |
67 subprocess.check_call(['hg', 'pull', '--repository', repo, '--quiet']) | 67 subprocess.check_call(['hg', 'pull', '--repository', repo, '--quiet']) |
68 | 68 |
69 def update(self, repo, rev, revname): | 69 def update(self, repo, rev, revname): |
70 subprocess.check_call(['hg', 'update', '--repository', repo, '--quiet',
'--check', '--rev', rev]) | 70 subprocess.check_call(['hg', 'update', '--repository', repo, '--quiet',
'--check', '--rev', rev]) |
71 | 71 |
72 def ignore(self, target, repo): | 72 def ignore(self, target, repo): |
73 config_path = os.path.join(repo, '.hg', 'hgrc') | 73 config_path = os.path.join(repo, '.hg', 'hgrc') |
74 ignore_path = os.path.join(repo, '.hg', 'dependencies') | 74 ignore_file = os.path.join('.hg', 'dependencies') |
| 75 ignore_path = os.path.join(repo, ignore_file) |
75 | 76 |
76 config = RawConfigParser() | 77 config = RawConfigParser() |
77 config.read(config_path) | 78 config.read(config_path) |
78 | 79 |
79 if not config.has_section('ui'): | 80 if not config.has_section('ui'): |
80 config.add_section('ui') | 81 config.add_section('ui') |
81 | 82 |
82 config.set('ui', 'ignore.dependencies', ignore_path) | 83 config.set('ui', 'ignore.dependencies', ignore_file) |
83 with open(config_path, 'w') as stream: | 84 with open(config_path, 'w') as stream: |
84 config.write(stream) | 85 config.write(stream) |
85 | 86 |
86 module = os.path.relpath(target, repo) | 87 module = os.path.relpath(target, repo) |
87 _ensure_line_exists(ignore_path, module) | 88 _ensure_line_exists(ignore_path, module) |
88 | 89 |
89 def postprocess_url(self, url): | 90 def postprocess_url(self, url): |
90 return url | 91 return url |
91 | 92 |
92 | 93 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 args = parser.parse_args() | 371 args = parser.parse_args() |
371 | 372 |
372 if args.quiet: | 373 if args.quiet: |
373 logging.disable(logging.INFO) | 374 logging.disable(logging.INFO) |
374 | 375 |
375 repos = args.repos | 376 repos = args.repos |
376 if not len(repos): | 377 if not len(repos): |
377 repos = [os.path.dirname(__file__)] | 378 repos = [os.path.dirname(__file__)] |
378 for repo in repos: | 379 for repo in repos: |
379 resolve_deps(repo) | 380 resolve_deps(repo) |
OLD | NEW |