Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: ensure_dependencies.py

Issue 29360531: Issue 4584 - Fix ignore file path (Closed)
Patch Set: Created Oct. 30, 2016, 8:23 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld