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

Side by Side Diff: gclient.py

Issue 3130007: Add revinfo --actual to fetch the actual revisions, (Closed)
Patch Set: address nit Created 10 years, 4 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_smoketest.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 """Meta checkout manager supporting both Subversion and GIT. 6 """Meta checkout manager supporting both Subversion and GIT.
7 7
8 Files 8 Files
9 .gclient : Current client configuration, written by 'config' command. 9 .gclient : Current client configuration, written by 'config' command.
10 Format is a Python script defining 'solutions', a list whose 10 Format is a Python script defining 'solutions', a list whose
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 custom_deps.append(' \"%s\": None,\n' % k) 786 custom_deps.append(' \"%s\": None,\n' % k)
787 new_gclient += self.DEFAULT_SNAPSHOT_SOLUTION_TEXT % { 787 new_gclient += self.DEFAULT_SNAPSHOT_SOLUTION_TEXT % {
788 'solution_name': d.name, 788 'solution_name': d.name,
789 'solution_url': d.url, 789 'solution_url': d.url,
790 'safesync_url' : d.safesync_url or '', 790 'safesync_url' : d.safesync_url or '',
791 'solution_deps': ''.join(custom_deps), 791 'solution_deps': ''.join(custom_deps),
792 } 792 }
793 # Print the snapshot configuration file 793 # Print the snapshot configuration file
794 print(self.DEFAULT_SNAPSHOT_FILE_TEXT % {'solution_list': new_gclient}) 794 print(self.DEFAULT_SNAPSHOT_FILE_TEXT % {'solution_list': new_gclient})
795 else: 795 else:
796 entries = sorted(self.tree(False), key=lambda i: i.name) 796 entries = {}
797 for d in entries: 797 for d in self.tree(False):
798 entry_url = GetURLAndRev(d) 798 if self._options.actual:
799 line = '%s: %s' % (d.name, entry_url) 799 entries[d.name] = GetURLAndRev(d)
800 if not d is entries[-1]: 800 else:
801 entries[d.name] = d.parsed_url
802 keys = sorted(entries.keys())
803 for x in keys:
804 line = '%s: %s' % (x, entries[x])
805 if x is not keys[-1]:
801 line += ';' 806 line += ';'
802 print line 807 print line
803 logging.info(str(self)) 808 logging.info(str(self))
804 809
805 def ParseDepsFile(self, direct_reference): 810 def ParseDepsFile(self, direct_reference):
806 """No DEPS to parse for a .gclient file.""" 811 """No DEPS to parse for a .gclient file."""
807 self.direct_reference = True 812 self.direct_reference = True
808 self.deps_parsed = True 813 self.deps_parsed = True
809 814
810 def root_dir(self): 815 def root_dir(self):
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 This allows the capture of an overall 'revision' for the source tree that 1108 This allows the capture of an overall 'revision' for the source tree that
1104 can be used to reproduce the same tree in the future. It is only useful for 1109 can be used to reproduce the same tree in the future. It is only useful for
1105 'unpinned dependencies', i.e. DEPS/deps references without a svn revision 1110 'unpinned dependencies', i.e. DEPS/deps references without a svn revision
1106 number or a git hash. A git branch name isn't 'pinned' since the actual 1111 number or a git hash. A git branch name isn't 'pinned' since the actual
1107 commit can change. 1112 commit can change.
1108 """ 1113 """
1109 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST', 1114 parser.add_option('--deps', dest='deps_os', metavar='OS_LIST',
1110 help='override deps for the specified (comma-separated) ' 1115 help='override deps for the specified (comma-separated) '
1111 'platform(s); \'all\' will process all deps_os ' 1116 'platform(s); \'all\' will process all deps_os '
1112 'references') 1117 'references')
1118 parser.add_option('-a', '--actual', action='store_true',
1119 help='gets the actual checked out revisions instead of the '
1120 'ones specified in the DEPS and .gclient files')
1113 parser.add_option('-s', '--snapshot', action='store_true', 1121 parser.add_option('-s', '--snapshot', action='store_true',
1114 help='creates a snapshot .gclient file of the current ' 1122 help='creates a snapshot .gclient file of the current '
1115 'version of all repositories to reproduce the tree') 1123 'version of all repositories to reproduce the tree, '
1124 'implies -a')
1116 (options, args) = parser.parse_args(args) 1125 (options, args) = parser.parse_args(args)
1117 client = GClient.LoadCurrentConfig(options) 1126 client = GClient.LoadCurrentConfig(options)
1118 if not client: 1127 if not client:
1119 raise gclient_utils.Error('client not configured; see \'gclient config\'') 1128 raise gclient_utils.Error('client not configured; see \'gclient config\'')
1120 client.PrintRevInfo() 1129 client.PrintRevInfo()
1121 return 0 1130 return 0
1122 1131
1123 1132
1124 def Command(name): 1133 def Command(name):
1125 return getattr(sys.modules[__name__], 'CMD' + name, None) 1134 return getattr(sys.modules[__name__], 'CMD' + name, None)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 return CMDhelp(parser, argv) 1212 return CMDhelp(parser, argv)
1204 except gclient_utils.Error, e: 1213 except gclient_utils.Error, e:
1205 print >> sys.stderr, 'Error: %s' % str(e) 1214 print >> sys.stderr, 'Error: %s' % str(e)
1206 return 1 1215 return 1
1207 1216
1208 1217
1209 if '__main__' == __name__: 1218 if '__main__' == __name__:
1210 sys.exit(Main(sys.argv[1:])) 1219 sys.exit(Main(sys.argv[1:]))
1211 1220
1212 # vim: ts=2:sw=2:tw=80:et: 1221 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698