Index: ensure_dependencies.py |
diff --git a/ensure_dependencies.py b/ensure_dependencies.py |
index c03069d6a3c99aaf80df95444d0a8757a42a7e1b..3a2498f8a72f3c4d65dfe2c4167f13bdb75d08f0 100755 |
--- a/ensure_dependencies.py |
+++ b/ensure_dependencies.py |
@@ -70,24 +70,21 @@ class Mercurial(): |
subprocess.check_call(['hg', 'update', '--repository', repo, '--quiet', '--check', '--rev', rev]) |
def ignore(self, target, repo): |
+ config_path = os.path.join(repo, '.hg', 'hgrc') |
+ ignore_path = os.path.join(repo, '.hg', 'dependencies') |
- if not self.istype(target): |
+ config = RawConfigParser() |
+ config.read(config_path) |
- config_path = os.path.join(repo, '.hg', 'hgrc') |
- ignore_path = os.path.abspath(os.path.join(repo, '.hg', 'dependencies')) |
+ if not config.has_section('ui'): |
+ config.add_section('ui') |
- config = RawConfigParser() |
- config.read(config_path) |
+ config.set('ui', 'ignore.dependencies', ignore_path) |
+ with open(config_path, 'w') as stream: |
+ config.write(stream) |
- if not config.has_section('ui'): |
- config.add_section('ui') |
- |
- config.set('ui', 'ignore.dependencies', ignore_path) |
- with open(config_path, 'w') as stream: |
- config.write(stream) |
- |
- module = os.path.relpath(target, repo) |
- _ensure_line_exists(ignore_path, module) |
+ module = os.path.relpath(target, repo) |
+ _ensure_line_exists(ignore_path, module) |
def postprocess_url(self, url): |
return url |