Mercurial > september
comparison september.py @ 4:bdfc8a4a335d draft
Expose more information to the command formatting.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 06 Apr 2015 20:03:11 -0700 |
parents | 6bbebb01f614 |
children | 9c6605b1619b |
comparison
equal
deleted
inserted
replaced
3:455043eb436a | 4:bdfc8a4a335d |
---|---|
137 help="See September's status for the given repository.") | 137 help="See September's status for the given repository.") |
138 | 138 |
139 # Parse arguments. | 139 # Parse arguments. |
140 res = parser.parse_args() | 140 res = parser.parse_args() |
141 repo_dir = res.repo or os.getcwd() | 141 repo_dir = res.repo or os.getcwd() |
142 work_dir = os.getcwd() | |
142 | 143 |
143 # Guess the repo type. | 144 # Guess the repo type. |
144 repo_type = res.scm | 145 repo_type = res.scm |
145 if not repo_type or repo_type == 'guess': | 146 if not repo_type or repo_type == 'guess': |
146 repo_type = guess_repo_type(repo_dir) | 147 repo_type = guess_repo_type(repo_dir) |
151 if repo_type not in repo_class: | 152 if repo_type not in repo_class: |
152 logger.error("Unknown repository type: %s" % repo_type) | 153 logger.error("Unknown repository type: %s" % repo_type) |
153 sys.exit(1) | 154 sys.exit(1) |
154 | 155 |
155 # Find the configuration file. | 156 # Find the configuration file. |
157 config_file_dir = None | |
156 config_file = res.config or os.path.join(repo_dir, '.september.cfg') | 158 config_file = res.config or os.path.join(repo_dir, '.september.cfg') |
157 config = configparser.ConfigParser(interpolation=None) | 159 config = configparser.ConfigParser(interpolation=None) |
158 if os.path.exists(config_file): | 160 if os.path.exists(config_file): |
159 logger.info("Loading configuration file: %s" % config_file) | 161 logger.info("Loading configuration file: %s" % config_file) |
160 config.read(config_file) | 162 config.read(config_file) |
163 config_file_dir = os.path.dirname(config_file) | |
161 | 164 |
162 # Validate the configuration. | 165 # Validate the configuration. |
163 if not config.has_section('september'): | 166 if not config.has_section('september'): |
164 config.add_section('september') | 167 config.add_section('september') |
165 config_sec = config['september'] | 168 config_sec = config['september'] |
257 repo.update(clone_dir, ti['id']) | 260 repo.update(clone_dir, ti['id']) |
258 | 261 |
259 command = config_sec['command'] % { | 262 command = config_sec['command'] % { |
260 'rev_id': ti['id'], | 263 'rev_id': ti['id'], |
261 'root_dir': clone_dir, | 264 'root_dir': clone_dir, |
265 'config_dir': config_file_dir, | |
266 'work_dir': work_dir, | |
262 'tag': tn} | 267 'tag': tn} |
263 logger.info("Running: %s" % command) | 268 logger.info("Running: %s" % command) |
264 subprocess.check_call(command, shell=use_shell) | 269 subprocess.check_call(command, shell=use_shell) |
265 | 270 |
266 ti['processed'] = True | 271 ti['processed'] = True |