View Javadoc
1   /*
2    * Copyright (C) 2014, Google Inc. and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  package org.eclipse.jgit.pgm;
11  
12  import org.eclipse.jgit.api.errors.GitAPIException;
13  import org.eclipse.jgit.gitrepo.RepoCommand;
14  import org.kohsuke.args4j.Argument;
15  import org.kohsuke.args4j.Option;
16  
17  @Command(common = true, usage = "usage_parseRepoManifest")
18  class Repo extends TextBuiltin {
19  
20  	@Option(name = "--base-uri", aliases = { "-u" }, usage = "usage_baseUri")
21  	private String uri;
22  
23  	@Option(name = "--groups", aliases = { "-g" }, usage = "usage_groups")
24  	private String groups = "default"; //$NON-NLS-1$
25  
26  	@Argument(required = true, metaVar = "metaVar_path", usage = "usage_pathToXml")
27  	private String path;
28  
29  	/** {@inheritDoc} */
30  	@Override
31  	protected void run() {
32  		try {
33  			new RepoCommand(db)
34  				.setURI(uri)
35  				.setPath(path)
36  				.setGroups(groups)
37  				.call();
38  		} catch (GitAPIException e) {
39  			throw die(e.getMessage(), e);
40  		}
41  	}
42  }