Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: gclient.py

Issue 1627009: Workaround output variance in pprint.pformat. (Closed)
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A wrapper script to manage a set of client modules in different SCM. 6 """A wrapper script to manage a set of client modules in different SCM.
7 7
8 This script is intended to be used to help basic management of client 8 This script is intended to be used to help basic management of client
9 program sources residing in one or more Subversion modules and Git 9 program sources residing in one or more Subversion modules and Git
10 repositories, along with other modules it depends on, also in Subversion or Git, 10 repositories, along with other modules it depends on, also in Subversion or Git,
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 }) 392 })
393 393
394 def _SaveEntries(self, entries): 394 def _SaveEntries(self, entries):
395 """Creates a .gclient_entries file to record the list of unique checkouts. 395 """Creates a .gclient_entries file to record the list of unique checkouts.
396 396
397 The .gclient_entries file lives in the same directory as .gclient. 397 The .gclient_entries file lives in the same directory as .gclient.
398 398
399 Args: 399 Args:
400 entries: A sequence of solution names. 400 entries: A sequence of solution names.
401 """ 401 """
402 text = "entries = \\\n" + pprint.pformat(entries, 2) + '\n' 402 # Sometimes pprint.pformat will use {', sometimes it'll use { ' ... It
403 # makes testing a bit too fun.
404 result = pprint.pformat(entries, 2)
405 if result.startswith('{\''):
406 result[0:2] = '{ \''
407 text = "entries = \\\n" + result + '\n'
403 file_path = os.path.join(self._root_dir, self._options.entries_filename) 408 file_path = os.path.join(self._root_dir, self._options.entries_filename)
404 gclient_utils.FileWrite(file_path, text) 409 gclient_utils.FileWrite(file_path, text)
405 410
406 def _ReadEntries(self): 411 def _ReadEntries(self):
407 """Read the .gclient_entries file for the given client. 412 """Read the .gclient_entries file for the given client.
408 413
409 Args: 414 Args:
410 client: The client for which the entries file should be read. 415 client: The client for which the entries file should be read.
411 416
412 Returns: 417 Returns:
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 1292
1288 if "__main__" == __name__: 1293 if "__main__" == __name__:
1289 try: 1294 try:
1290 result = Main(sys.argv) 1295 result = Main(sys.argv)
1291 except gclient_utils.Error, e: 1296 except gclient_utils.Error, e:
1292 print >> sys.stderr, "Error: %s" % str(e) 1297 print >> sys.stderr, "Error: %s" % str(e)
1293 result = 1 1298 result = 1
1294 sys.exit(result) 1299 sys.exit(result)
1295 1300
1296 # vim: ts=2:sw=2:tw=80:et: 1301 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698