View Javadoc
1   /*
2    * Copyright (C) 2019, Google LLC 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  
11  package org.eclipse.jgit.pgm;
12  
13  import org.eclipse.jgit.internal.storage.file.FileRepository;
14  import org.kohsuke.args4j.Option;
15  import org.kohsuke.args4j.spi.ExplicitBooleanOptionHandler;
16  
17  @Command(common = true, usage = "usage_convertRefStorage")
18  class ConvertRefStorage extends TextBuiltin {
19  
20  	@Option(name = "--format", usage = "usage_convertRefStorageFormat")
21  	private String format = "reftable"; //$NON-NLS-1$
22  
23  	@Option(name = "--backup", handler = ExplicitBooleanOptionHandler.class, aliases = {
24  			"-b" }, usage = "usage_convertRefStorageBackup")
25  	private boolean backup = true;
26  
27  	@Option(name = "--reflogs", handler = ExplicitBooleanOptionHandler.class, aliases = {
28  			"-r" }, usage = "usage_convertRefStorageRefLogs")
29  	private boolean writeLogs = true;
30  
31  	/** {@inheritDoc} */
32  	@Override
33  	protected void run() throws Exception {
34  		((FileRepository) db).convertRefStorage(format, writeLogs, backup);
35  	}
36  }