Commits

Anonymous committed 0802daa

Support limiting rebuild to specific VCS(-es).

Comments (0)

Files changed (1)

smart-live-rebuild.py

 vcsl = [GitSupport, HgSupport, SvnSupport]
 
 def main(argv):
+	vcsnames = [x.inherit for x in vcsl]
 	opt = OptionParser(
 			usage='%prog [options] -- [emerge options]',
 			version='%%prog %s' % PV,
-			description='Enumerate all live packages in system, check their repositories for updates and remerge the updated ones. Supported VCS-es: %s.' % ', '.join([x.inherit for x in vcsl])
+			description='Enumerate all live packages in system, check their repositories for updates and remerge the updated ones. Supported VCS-es: %s.' % ', '.join(vcsnames)
 	)
 	opt.add_option('-C', '--no-color', action='store_true', dest='monochrome', default=False,
 		help='Disable colorful output.')
 		help='Only print a list of the packages which were updated; do not call emerge to rebuild them.')
 	opt.add_option('-R', '--record', action='store_false', dest='oneshot', default=True,
 		help='Omit passing --oneshot option to portage, and thus add updated packages to the @world set.')
+	opt.add_option('-t', '--type', action='append', type='choice', choices=vcsnames, dest='types',
+		help='Limit rebuild to packages using specific VCS. If used multiple times, all specified VCS-es will be used.')
 	(opts, args) = opt.parse_args(argv[1:])
 
 	if opts.monochrome:
 		out.monochromize()
+	if opts.types:
+		vcslf = filter(lambda x: x.inherit in opts.types, vcsl)
+	else:
+		vcslf = vcsl
 
 	out.s1('Enumerating packages ...')
 
 		try:
 			inherits = db.aux_get(cpv, ['INHERITED'])[0].split()
 
-			for vcs in vcsl:
+			for vcs in vcslf:
 				if vcs.match(inherits):
 					env = getenv()
 					vcs = vcs(cpv, env)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.